Association: table of contents
Filter:
Classes | Collections

Association : Magnitude : Object

relate two objects

Description

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.

Class Methods

Association.new(key, value)

Create an Association between two objects.

(
x = 'name' -> 100;
x.postln;
)

Arguments:

key

any object

value

any object

Inherited class methods

Instance Methods

Accessing

.key

.key = value

the key object.

.value

.value = value

the value object.

Testing

==(anAssociation)

Compare the keys of two Associations.

<(anAssociation)

Compare the keys of two Associations.

.hash

Compute the hash value of the Association.

Writing to streams

.printOn(stream)

Write a string representation to the stream.

.storeOn(stream)

Write a compilable string representation to the stream.

Inherited instance methods

Undocumented instance methods

.buildForProxy(proxy, channelOffset: 0, index)

From extension in /usr/local/share/SuperCollider/SCClassLibrary/JITLib/ProxySpace/wrapForNodeProxy.sc

.embedInStream(inval)

.proxyControlClass

From extension in /usr/local/share/SuperCollider/SCClassLibrary/JITLib/ProxySpace/wrapForNodeProxy.sc

.transformEvent(event)

Examples

// 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;
    }
};
)