Next: , Previous: , Up: stdlib   [Index]


5.13 Hashtables

The (rnrs hashtables (6)) library provides a set of operations on hashtables.

A hashtable is a data structure that associates keys with values. Any object can be used as a key, provided a hash function and a suitable equivalence function is available.

A hash function is a procedure that maps keys to exact integer objects. It is the programmer’s responsibility to ensure that the hash function is compatible with the equivalence function, which is a procedure that accepts two keys and returns true if they are equivalent and #f otherwise.

Standard hashtables for arbitrary objects based on the eq? and eqv? predicates (baselib predicates) are provided. Also, hash functions for arbitrary objects, strings, and symbols are provided.

This section uses the hashtable parameter name for arguments that must be hashtables, and the key parameter name for arguments that must be hashtable keys.