next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > The Macaulay2 language > hash tables > applyKeys

applyKeys -- apply a function to each key in a hash table

Synopsis

Description

i1 : H = new HashTable from {1 => a, 2 => b, 3 => c}

o1 = HashTable{1 => a}
               2 => b
               3 => c

o1 : HashTable
i2 : applyKeys(H, k -> k + 100)

o2 = HashTable{101 => a}
               102 => b
               103 => c

o2 : HashTable

Caveat

It is an error for the function f to return two pairs with the same key.

See also

Ways to use applyKeys :