Forgot a help fix: Drag a dock's title bar, not divider, to reposition
[supercollider.git] / HelpSource / Classes / Association.schelp
blob86a610c8eb57c8fb3a7a8090e895c2c09239f942
1 CLASS::Association
2 summary::relate two objects
3 categories::Collections
5 DESCRIPTION::
6 Associates a key with a value.
7 Associations can be created via the -> operator which is defined in class link::Classes/Object::.
9 Associations are used internally in link::Classes/Dictionary::.
11 CLASSMETHODS::
13 method::new
14 Create an Association between two objects.
15 code::
17 x = 'name' -> 100;
18 x.postln;
21 argument::key
22 any object
23 argument::value
24 any object
26 INSTANCEMETHODS::
28 subsection::Accessing
30 method::key
31 the key object.
33 method::value
34 the value object.
36 subsection::Testing
38 method::==
39 Compare the keys of two Associations.
41 method::<
42 Compare the keys of two Associations.
44 method::hash
45 Compute the hash value of the Association.
47 subsection::Writing to streams
49 method::printOn
50 Write a string representation to the stream.
52 method::storeOn
53 Write a compileable string representation to the stream.
55 EXAMPLES::
57 code::
58 // associations can be a good way to store named data in order:
60 a = [\x -> 700, \y -> 200, \z -> 900];
62 fork {
63         a.do { |assoc|
64                 assoc.key.postln;
65                 assoc.value.postln;
66                 (freq: assoc.value).play;
67                 2.wait;
68         }