Next: Guardians, Previous: Records, Up: The language [Contents][Index]
The rep.data.tables module provides a flexible hash table
implementation (see Modules). Each hash table is represented by a
lisp object satisfying the tablep predicate:
Return true if arg is a hash table.
Hash tables may be created by using the make-table and
make-weak-table functions:
Create and return a new hash table. When storing and referencing keys it will use the function hash-fun to map keys to hash codes (positive fixnums), and the predicate function compare-fun to compare two keys (should return true if the keys are considered equal).
Similar to make-table, except that key-value pairs stored in the
table are said to be “weakly keyed”. That is, they are only retained
in the table as long the key has not been garbage collected.
Unlike with tables created by the make-table function, the fact
that the key is stored in the table is not considered good enough to
prevent it being garbage collected.
Return the value stored in hash table table indexed by object key. Returns false if no such value exists.
Returns true if the hash table table contains a value associated with key.
Associate the value value with key in hash table
table. Returns value.
Remove any value stored in table associated with key.
Call function function for every key-value pair stored in hash
table table. For each pair, the function is called with arguments
(key value).
Returns the number of items currently stored in table.
Several hash functions are also provided:
Return an integer representing the string string.
Call (string-hash (symbol-name symbol)).
Return a hash value representing object arg. The hash is generated from the address of the object.
Return a hash value representing object arg. The hash is generated from the contents of the object.
Next: Guardians, Previous: Records, Up: The language [Contents][Index]