« Return to Thread: tabbing glitch

Re: merging dictionaries

by Josh Parmenter :: Rate this Message:

Reply to Author | View in Thread

There doesn't seem to be a merge-like method... would something like  
this work?

a = IdentityDictionary.new;
a.add(\a -> 1)
a.add(\b -> 1)
a.add(\c -> 1)

b = IdentityDictionary.new;
b.add(\d -> 1)
b.add(\e -> 1)
b.add(\f -> 1)

c = IdentityDictionary.new;

[b, a].do({arg aID; // the IdentityDictionary
        aID.keysValuesDo({arg key, val; // parse through its keys and values
                c.add(key -> val)
                })
        })

c;

Best,

Josh

On Feb 22, 2008, at 6:57 PM, koonce@... wrote:

>
> What is the simplest way to merge IdentityDictionaries, with different
> keys, into one?
>
> Paul Koonce
>
>
> _______________________________________________
> sc-users mailing list
> sc-users@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-users

******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/

“Every composer – at all times and in all cases – gives his own  
interpretation of how modern society is structured: whether actively  
or passively, consciously or unconsciously, he makes choices in this  
regard. He may be conservative or he may subject himself to continual  
renewal; or he may strive for a revolutionary, historical or social  
palingenesis." - Luigi Nono
*/

_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

 « Return to Thread: tabbing glitch