i1 : H = new HashTable from {1 => 10, 2 => 15, 3 => 20}
o1 = HashTable{1 => 10}
2 => 15
3 => 20
o1 : HashTable
|
i2 : applyPairs(H, (k,v) -> (k+1, v+10))
o2 = HashTable{2 => 20}
3 => 25
4 => 30
o2 : HashTable
|
i3 : applyPairs(H, (k,v) -> (v,k))
o3 = HashTable{10 => 1}
15 => 2
20 => 3
o3 : HashTable
|
It is an error for the function f to return two pairs with the same key.
The object applyPairs is a compiled function.