[top][index]
search for:

applyValues -- apply a function to each value

applyValues(x,f) -- applies f to each value v in the hash table x to produce a new hash table.

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

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

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

o1 : HashTable
i2 : applyValues(x, v -> v + 100)

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

o2 : HashTable

See also:

  • applyPairs -- apply a function to pairs in a hash table
  • applyKeys -- apply a function to each key in a hash table
  • Ways to use applyValues :

  • applyValues(HashTable,Function)

  • [top][index]
    search for: