GNU Info

Info Node: (librep.info)Hash Tables

(librep.info)Hash Tables


Next: Guardians Prev: Records Up: The language
Enter node , (file) or (file)node

Hash Tables
===========

   The `rep.data.tables' module provides a flexible hash table
implementation (Note: Modules). Each hash table is represented by a
lisp object satisfying the `tablep' predicate:

 - Function: tablep arg
     Return true if ARG is a hash table.

   Hash tables may be created by using the `make-table' and
`make-weak-table' functions:

 - Function: make-table hash-fun compare-fun
     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).

 - Function: make-weak-table hash-fun compare-fun
     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.

 - Function: table-ref table key
     Return the value stored in hash table TABLE indexed by object KEY.
     Returns false if no such value exists.

 - Function: table-bound-p table key
     Returns true if the hash table TABLE contains a value associated
     with KEY.

 - Function: table-set table key value
     Associate the value VALUE with KEY in hash table TABLE. Returns
     `value'.

 - Function: table-unset table key
     Remove any value stored in TABLE associated with KEY.

 - Function: table-walk function table
     Call function FUNCTION for every key-value pair stored in hash
     table TABLE. For each pair, the function is called with arguments
     `(KEY VALUE)'.

   Several hash functions are also provided:

 - Function: string-hash string
     Return an integer representing the string STRING.

 - Function: symbol-hash symbol
     Call `(string-hash (symbol-name SYMBOL))'.

 - Function: eq-hash arg
     Return a hash value representing object ARG. The hash is generated
     from the _address_ of the object.

 - Function: equal-hash arg
     Return a hash value representing object ARG. The hash is generated
     from the _contents_ of the object.


automatically generated by info2www version 1.2.2.9