(util hashtables) - Hashtable utilities

Library (util hashtables)

This library provides extra utilities for hashtable operation.

Function hashtable-for-each proc hashtable
Function hashtable-map proc hashtable

proc must be a procedure which accepts 2 arguments. hashtable must be a hashtable.

Iterates all keys and values in the given hashtable and passes them to proc respectively.

The hashtable-for-each returns unspecified value. The hashtable-map returns a list of the proc result.

These procedures are analogous to for-each and map respectively.

Function hashtable-fold kons hashtable knil

kons must be a procedure which accepts 3 arguments. hashtable must be a hashtable.

Iterates all keys and values in the given hashtable and passes them and the result of kons to kons respectively. The first iteration of the third argument is knil. The procedure returns the result of all iterations.

Analogous to fold.

Function hashtable->alist hashtable

Converts to hashtable to an alist.

Function alist->hashtable alist :key (compare eq?) (hasher symbol-hash)

Converts alist to hashtable.

The keyword arguments specify how to create the returning hashtable. By default, it will use make-eq-hashtable. If it's specified then it will use make-hashtable to create a hashtable.