Skip to content

Key ​

An accessor tag — At(assoc, Key(k)) looks up the value for key k in an Association.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageKey!
Key(k)an inert tag around k, meaningful as the second operand of At on an Association
Typed signatures
TypePackageApplies
(any) -> anycombinatoricsalways

Domain: Collections

Details
  • Reads the SAME Rule-pair Association AssociationThread and list-functional.ts's Association build — not compute-engine's own string-keyed Dictionary.
  • Missing(k) answers Missing rather than leaving the call unevaluated, matching Wolfram's own default.
  • Wolfram's OTHER reading of Key — as a standalone operator, Key(k)(assoc) — isn't implemented; only the At(assoc, Key(k)) form is.

Examples

Basic #
live ↗
InAssociation(Rule(a,1),Rule(b,2))[Key(b)]\mathrm{Association}(\mathrm{Rule}(a, 1), \mathrm{Rule}(b, 2))[\mathrm{Key}(b)]Out22
Scope #
live ↗
InAssociation(Rule(a,1))[Key(z)]\mathrm{Association}(\mathrm{Rule}(a, 1))[\mathrm{Key}(z)]OutMissing\mathrm{Missing}
About
Examples2
Checked againstWolfram Language 1 agree1 differ
CrosswalkWolfram Language

See also: AssociationThread, At