GNU Info

Info Node: (elisp)Hash Tables

(elisp)Hash Tables


Next: Symbols Prev: Sequences Arrays Vectors Up: Top
Enter node , (file) or (file)node

Hash Tables
***********

   A hash table is a very fast kind of lookup table, somewhat like an
alist in that it maps keys to corresponding values.  It differs from an
alist in these ways:

   * Lookup in a hash table is extremely fast for large tables--in
     fact, the time required is essentially _independent_ of how many
     elements are stored in the table.  For smaller tables (a few tens
     of elements) alists may still be faster because hash tables have a
     more-or-less constant overhead.

   * The correspondences in a hash table are in no particular order.

   * There is no way to share structure between two hash tables, the
     way two alists can share a common tail.

   Emacs Lisp (starting with Emacs 21) provides a general-purpose hash
table data type, along with a series of functions for operating on them.
Hash tables have no read syntax, and print in hash notation, like this:

     (make-hash-table)
          => #<hash-table 'eql nil 0/65 0x83af980>

(The term "hash notation" refers to the initial `#' character--Note:
Printed Representation--and has nothing to do with the term "hash
table.")

   Obarrays are also a kind of hash table, but they are a different type
of object and are used only for recording interned symbols (Note:
Creating Symbols).

Creating Hash
Hash Access
Defining Hash
Other Hash

automatically generated by info2www version 1.2.2.9