[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sc-devel] Fwd: [sc-users] help file -- MultiLevelIdentityDictionary



Begin forwarded message:
(
a = MultiLevelIdentityDictionary.new.putTree(
\key0, [
\key1, [
\key11, 11,
\key12, 12
],
\key2, [
\key21, 21,
\key22, 22
]
]
)
)

WTF? According to this definition, you can't put anything into a MLID using putTree other than a Function.

prPutTree { arg keys,items;
forBy(0,items.size - 1,2,{ arg i;
var key,item;
key = items.at(i);
item = items.at(i + 1);
if(item.isKindOf(Function),{
this.put(* keys ++ [key,item]);
},{
//array
this.prPutTree(keys ++ [key],item);
})
})
}

Any objection to changing it to this?

prPutTree { arg keys,items;
forBy(0,items.size - 1,2,{ arg i;
var key,item;
key = items.at(i);
item = items.at(i + 1);
if(item.isArray.not,{
this.put(* keys ++ [key,item]);
},{
//array
this.prPutTree(keys ++ [key],item);
})
});
}

hjh


: H. James Harkins

: jamshark70@xxxxxxxxxxxxxxxxx

: http://www.dewdrop-world.net

.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:


"Come said the Muse,

Sing me a song no poet has yet chanted,

Sing me the universal."  -- Whitman