Wolfram: Association. Map Function
Map Function to Association Keys
KeyMap[ f, asso ]-
- Map function to each key.
- Return the new association.
KeyMap[ ff, Association[ 5 -> aa, 4 -> bb ] ] (* <|ff[5] -> aa, ff[4] -> bb|> *)
Map to Values
Map[ f, asso ]-
- Map function to each value.
- Return the new association.
Map[ ff, Association[ 5 -> aa, 4 -> bb ] ] (* <|5 -> ff[aa], 4 -> ff[bb]|> *)
Map to Key Value Pair
KeyValueMap[ f, asso ]-
- Map function to each Pair of Key and Value, as 2 args to the function.
- Return a list.
KeyValueMap[ ff, Association[ 5 -> aa, 4 -> bb ] ] (* {ff[5, aa], ff[4, bb]} *)