Previous: , Up: stdlib hashtable   [Index]


5.13.4 Hash functions

The equal-hash, string-hash, and string-ci-hash procedures of this section are acceptable as the hash functions of a hashtable only if the keys on which they are called are not mutated while they remain in use as keys in the hashtable.

Procedure: equal-hash obj

Return an integer hash value for obj, based on its structure and current contents. This hash function is suitable for use with equal? as an equivalence function.

NOTE Like equal?, the equal-hash procedure must always terminate, even if its arguments contain cycles.

Procedure: string-hash string
Procedure: string-hash string max-len

Return an integer hash value for string, based on its current contents. This hash function is suitable for use with string=? as an equivalence function.

As Vicare extension:

NOTE When the hash value is computed using a number of characters N less than the string length: applications must not assume that two strings having the first N characters equal will have the same hash value.

Procedure: string-ci-hash string
Procedure: string-ci-hash string max-len

Return an integer hash value for string based on its current contents, ignoring case. This hash function is suitable for use with string-ci=? as an equivalence function.

The optional argument max-len is used as in string-hash.

Procedure: symbol-hash symbol

Return an integer hash value for symbol.


Previous: , Up: stdlib hashtable   [Index]