KeyValueMap[f,key1val1,key2val2,…]
gives the list {f[key1,val1],f[key2,val2],…}.
KeyValueMap[f]
represents an operator form of KeyValueMap that can be applied to an expression.
KeyValueMap
KeyValueMap[f,key1val1,key2val2,…]
gives the list {f[key1,val1],f[key2,val2],…}.
KeyValueMap[f]
represents an operator form of KeyValueMap that can be applied to an expression.
Details
- KeyValueMap[f][assoc] is equivalent to KeyValueMap[f,assoc].
- Parallelize[KeyValueMap[f,key1val1,key2val2,…]] computes KeyValueMap[f,key1val1,key2val2,…] in parallel on all subkernels. »
Examples
open all close allBasic Examples (2)
Map a function over the keys and values of an association:
KeyValueMap[f, <|a -> 1, b -> 2, c -> 3|>]Use the operator form of KeyValueMap:
KeyValueMap[f][<|a -> 1, b -> 2, c -> 3|>]Properties & Relations (3)
KeyValueMap[f,assoc] is equivalent to MapApply[f,Normal[assoc]]:
KeyValueMap[f, <|a -> 1, b -> 2, c -> 3|>]% === MapApply[f, Normal[<|a -> 1, b -> 2, c -> 3|>]]KeyValueMap maps a function over the keys and values in an association (and returns a list):
KeyValueMap[f, <|a -> 1, b -> 2, c -> 3|>]AssociationMap maps a function over the rules in an association:
AssociationMap[Reverse, <|a -> 1, b -> 2, c -> 3|>]KeyMap maps a function over the keys in an association:
KeyMap[f, <|a -> 1, b -> 2, c -> 3|>]Map maps a function over the values in an association:
Map[f, <|a -> 1, b -> 2, c -> 3|>]KeyValueMap can be parallelized automatically:
Parallelize[KeyValueMap[List, AssociationMap[Prime, Range[20]]]]See Also
Normal MapIndexed MapApply Map KeyMap AssociationMap Association Keys Values
Function Repository: ValueMap
Related Guides
History
Text
Wolfram Research (2015), KeyValueMap, Wolfram Language function, https://reference.wolfram.com/language/ref/KeyValueMap.html.
CMS
Wolfram Language. 2015. "KeyValueMap." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/KeyValueMap.html.
APA
Wolfram Language. (2015). KeyValueMap. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/KeyValueMap.html
BibTeX
@misc{reference.wolfram_2026_keyvaluemap, author="Wolfram Research", title="{KeyValueMap}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/KeyValueMap.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_keyvaluemap, organization={Wolfram Research}, title={KeyValueMap}, year={2015}, url={https://reference.wolfram.com/language/ref/KeyValueMap.html}, note=[Accessed: 13-June-2026]}