Associates a key with a value. Associations can be created via the -> operator which is defined in class Object.
Associations are used internally in Dictionary.
Create an Association between two objects.
(
x = 'name' -> 100;
x.postln;
)
key |
any object |
value |
any object |
the key object.
the value object.
Compare the keys of two Associations.
Compare the keys of two Associations.
Compute the hash value of the Association.
Write a string representation to the stream.
Write a compilable string representation to the stream.
// associations can be a good way to store named data in order:
(
a = [\x -> 700, \y -> 200, \z -> 900];
fork {
a.do { |assoc|
assoc.key.postln;
assoc.value.postln;
(freq: assoc.value).play;
2.wait;
}
};
)