Hi Eirik,
There might be better ways of approaching this but I'd do something like:
(
a = [
[\default, [\freq, 800, \amp, 0.4]],
[\delay, [\dlyTime, 0.4, \feedback, 0.4]],
[\pan, [\pos, 0.0]]
];
)
f = {|item, container| container[container.detectIndex({|cItem| cItem[0] == item; })][1]; };
Synth(\default, f.value(\default, a))
...this maybe. Hope I got your question right.
Best,
B.B.
On Apr 19, 2009, at 2:47 AM, Eirik Arthur Blekesaune wrote:
Hi list,
I have synthparameters stored in this array:
(
a = [
[\fm, [\freq, 800, \amp, 0.4]],
[\delay, [\dlyTime, 0.4, \feedback, 0.4]],
[\pan, [\pos, 0.0]]
];
)
What the fastest way to find the value for two given keys? I know I could use IdentityDictionary or an MLID , but I am dependant of have the items ordered.
I have made a function which is really ugly, using a lot of collect and detectIndex. I've also stored the indexes in an IdentityDictionary, but that really feels like reinventing the wheel, and the code looks messy as well. I'm sure there must be a clever and efficient way to do this? Are there any other datastructures better suited for this task?
-eirik