Key
Key[key]
represents a key used to access a value in an association.
Key[key][assoc]
extracts the value corresponding to key in the association assoc.
Details
- Key is used in functions such as Part to access values in Association objects.
- Key can normally be omitted when key is a string.
Examples
Basic Examples (4)
Extract a value from an association as a part:
Extract a value from an association by function application:
The Key wrapper is not necessary when the key is a string:
Lookups in associations interoperate with parts in lists and other expressions:
The explicit Key can be omitted when the keys in an association are strings:
Key is normally generated by functions such as Position:
Use Extract to extract the values:
Text
Wolfram Research (2014), Key, Wolfram Language function, https://reference.wolfram.com/language/ref/Key.html.
CMS
Wolfram Language. 2014. "Key." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Key.html.
APA
Wolfram Language. (2014). Key. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Key.html