next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: scanValues

scanValues -- apply a function to each value in a hash table or database

Synopsis

Description

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

Caveat

This function requires an immutable hash table. To scan the values in a mutable hash table, use scan(values t, f).

See also

Ways to use scanValues :