AssociationMap

AssociationMap[f,{key1,key2,}]

creates the association key1f[key1],key2f[key2],.

AssociationMap[f,key1val1,key2val2,]

creates the association f[key1val1],f[key2val2],.

AssociationMap[f]

represents an operator form of AssociationMap that can be applied to an expression.

Details

Examples

open allclose all

Basic Examples  (2)

Create an association by mapping a function over a list of keys:

Create an "inverted index" by swapping keys and values:

Use the operator form of AssociationMap:

Possible Issues  (1)

AssociationMap[f,assoc] can return invalid associations if f does not return a rule:

Wolfram Research (2014), AssociationMap, Wolfram Language function, https://reference.wolfram.com/language/ref/AssociationMap.html.

Text

Wolfram Research (2014), AssociationMap, Wolfram Language function, https://reference.wolfram.com/language/ref/AssociationMap.html.

BibTeX

@misc{reference.wolfram_2021_associationmap, author="Wolfram Research", title="{AssociationMap}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/AssociationMap.html}", note=[Accessed: 17-May-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_associationmap, organization={Wolfram Research}, title={AssociationMap}, year={2014}, url={https://reference.wolfram.com/language/ref/AssociationMap.html}, note=[Accessed: 17-May-2021 ]}

CMS

Wolfram Language. 2014. "AssociationMap." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AssociationMap.html.

APA

Wolfram Language. (2014). AssociationMap. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AssociationMap.html