i1 : H = new HashTable from {1 => 10, 2 => 15, 3 => 20}
o1 = HashTable{1 => 10}
2 => 15
3 => 20
o1 : HashTable
|
i2 : applyKeys(H, k -> k + 100)
o2 = HashTable{101 => 10}
102 => 15
103 => 20
o2 : HashTable
|
i3 : applyKeys(H, k -> k//2, max)
o3 = HashTable{0 => 10}
1 => 20
o3 : HashTable
|
i4 : applyKeys(H, k -> k//2, plus)
o4 = HashTable{0 => 10}
1 => 35
o4 : HashTable
|
It is an error for the function f to return two pairs with the same key. When this is a possibility, use the function g to specify how the two pairs should be reconciled.
The object applyKeys is a compiled function.