Next: Range Table Type, Previous: Char Table Type, Up: Programming Types [Contents][Index]
A hash table is a table providing an arbitrary mapping from one Lisp object to another, using an internal indexing method called hashing. Hash tables are very fast (much more efficient that using an association list, when there are a large number of elements in the table).
Hash tables have a special read syntax beginning with
‘#s(hash-table’ (this is an example of structure read
syntax. This notation is also used for printing when
print-readably
is t
.
Otherwise they print in hash notation (The “hash” in “hash notation” has nothing to do with the “hash” in “hash table”), giving the number of elements, total space allocated for elements, and a unique number assigned at the time the hash table was created. (Hash tables automatically resize as necessary so there is no danger of running out of space for elements.)
(make-hash-table :size 50) ⇒ #<hash-table 0/107 0x313a>
See Hash Tables, for information on how to create and work with hash tables.