REF HASHTABLES Titch Le Bek, Rob Duncan, 1986 COPYRIGHT University of Sussex 1993. All Rights Reserved. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<< LISP HASH TABLES >>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< This file briefly describes the functions, variables and constants documented in Chapter 16 of the standard Common Lisp guide, which is: Common Lisp: The Language (Guy L. Steele, Digital Press, 1984). ------------------------------------------------- 1 A Listing of Functions Variables and Constants ------------------------------------------------- (clrhash hash-table) [function] Removes all the entries from hash-table and returns the hash table itself. (gethash key hash-table &optional default) [function] Finds the entry in hash-table whose key is key and returns the associated value. If there is no such entry, gethash returns default which is nil if not specified. (hash-table-count hash-table) [function] Returns the number of entries in hash-table. When a hash-table is first created or has been cleared, the number of entries is zero. (hash-table-p object) [function] Returns true if object is a hash-table and nil otherwise. (hash-table-rehash-size hash-table) [function] (hash-table-rehash-threshold hash-table) [function] (hash-table-size hash-table) [function] (hash-table-test hash-table) [function] These functions return (respectively) the rehash size, rehash threshold, table size, and test function of the given hash-table. The result of hash-table-test is always a symbol. (make-hash-table &key :test :size [function] :rehash-size :rehash-threshold) Creates and returns a new hash table. The :test argument determines how keys are compared; it must be one of the four symbols eq, eql, equal, or equalp, or the functional value of one of these symbols. The default value of :test is eql. :size sets the initial size of the hash table. :rehash-size specifies how much to increase the size of the hash table when it becomes full. :rehash-threshold specifies how full the hash table can get before it must grow. (maphash function hash-table) [function] For each entry in hash-table, maphash calls function on two arguments : the key of the entry and the value of the entry. maphash returns nil. (remhash key hash-table) [function] If an entry for key exists in hash-table, the entry is removed and remhash returns t; otherwise returns nil. (sxhash object) [function] Returns a non-negative fixnum hash code for object. (with-hash-table-iterator (mmname hash-table) [macro] {form}*) The name mname is bound and defined as if by macrolet, with the body forms as its lexical scope, to be a `generator macro', such that successive invocations (mname) will return entries, one by one, from hash-table. At each invocation of the generator macro, there are two possibilities. If there is yet another unprocessed entry in hash-table, then three values are returned: t, the key of the hash table entry, and the associated value of the hash table entry. On the other hand, if there are no more unprocessed entries, then one value is returned: nil. --- C.all/lisp/ref/hashtables --- Copyright University of Sussex 1993. All rights reserved.