Key Value Pairs:
Filter:
Reference | Collections | Interfaces

Key Value Pairs

An interface for translating between three common data structures: Dictionaries, Arrays of Associations and of Pairs

Motivation

There are three very similar ways to represent maps between keys and values, each of which have a specific purpose:

key value pairscommon representation of arguments[\freq, 452, \amp, 0.2]
collections of associationsordering, array and collection methods[0 -> [1, 2, 3], 1 -> [2, 1]]
dictionaries: fast lookupevent compatibility(instrument: \sine, freq: 561)

To make it easy to translate between these purposes and representations, there is a uniform set of methods:

asPairsreturns an array of key value pairs
asAssociationsreturns an array of associations
asDictreturns an IdentityDictionary.

Examples

Mapping Parameters

The method asDict optionally takes a mergeFunc and a class argument.

The method asEvent is a shortcut:

The methods asAssociations and asPairs optionally take a class argument.