applyValues

applyValues(x,f) -- applies f to each value v in the hash table x to produce a new hash table.

Thus f should be a function of one variable v which returns a new value v' for the key k in the resulting hash table.

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

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

o1 : HashTable
i2 : applyValues(x, v -> v + 100)

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

o2 : HashTable

See also applyPairs and applyKeys.


topindexpreviousupnext