hashtable_for_each


hashtable_for_each(fn, ht)
      

For each entry in the hash table ht, call the function fn by passing it the key and value as arguments. The order in which keys and values are visited is unspecified.

Return void.

While a call to hashtable_for_each is being performed on ht, it is an error to call any of the following procedures on ht: hashtable_at, hashtable_set, hashtable_for_each, hashtable_keys, hashtable_values and hashtable_entries. It is also an error to compare for equality (directly or indirectly with member, assoc, hashtable_at, etc.) an object that contains ht. All these functions may cause the hash table to be reordered and resized. This restriction allows a more efficient iteration over the key/value bindings.

Examples:


let h = make_eq_hashtable()
hashtable_set(h, 'name, "nemo")
hashtable_set(h, 'age, 1)
hashtable_for_each(^(k, v) println(k, ": ", v), h)
//> name: nemo
    age: 1          
      

Also see:

hashtable_keys
hashtable_values
hashtable_entries


Core Module Index | Contents