applyKeys

applyKeys(x,f) -- applies f to each key k in the hash table x to produce a new hash table.

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

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

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

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

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

o2 : HashTable

See also applyValues and applyPairs.


topindexpreviousupnext