scanValues(t, f) applies the function f to each value in the hash table t.
i1 : t = hashTable {{1,8},{2,20},{3,4},{4,20}} o1 = HashTable{1 => 8 } 2 => 20 3 => 4 4 => 20 o1 : HashTable |
i2 : scanValues(t, print) 8 20 4 20 |
i3 : scanValues(t, v -> if v>10 then print v) 20 20 |
This function requires an immutable hash table. To scan the values in a mutable hash table, use scan(values t, f).