]> code.delx.au - gnu-emacs/blobdiff - lispref/hash.texi
Add copyright notice and copying permissions.
[gnu-emacs] / lispref / hash.texi
index 107935f1ba06e4745a1dda010d4f1593f0d38551..66420476d422cf44db6c7b7a71fb9a29d60151b5 100644 (file)
@@ -1,6 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+@c Copyright (C) 1999, 2002, 2003, 2004, 2005,
+@c   2006 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/hash
 @node Hash Tables, Symbols, Sequences Arrays Vectors, Top
@@ -27,9 +28,9 @@ There is no way to share structure between two hash tables,
 the way two alists can share a common tail.
 @end itemize
 
-  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:
+  Emacs Lisp 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:
 
 @example
 (make-hash-table)
@@ -46,10 +47,10 @@ of object and are used only for recording interned symbols
 (@pxref{Creating Symbols}).
 
 @menu
-* Creating Hash::
-* Hash Access::
-* Defining Hash::
-* Other Hash::
+* Creating Hash::       Functions to create hash tables.
+* Hash Access::         Reading and writing the hash table contents.
+* Defining Hash::       Defining new comparison methods
+* Other Hash::          Miscellaneous.
 @end menu
 
 @node Creating Hash
@@ -146,11 +147,11 @@ number.
 The default value is 1.5.
 
 @item :rehash-threshold @var{threshold}
-This specifies the criterion for when the hash table is ``full.''  The
-value, @var{threshold}, should be a positive floating point number, no
-greater than 1.  The hash table is ``full'' whenever the actual number of
-entries exceeds this fraction of the nominal size.  The default for
-@var{threshold} is 0.8.
+This specifies the criterion for when the hash table is ``full'' (so
+it should be made larger).  The value, @var{threshold}, should be a
+positive floating point number, no greater than 1.  The hash table is
+``full'' whenever the actual number of entries exceeds this fraction
+of the nominal size.  The default for @var{threshold} is 0.8.
 @end table
 @end defun
 
@@ -167,7 +168,9 @@ This function is obsolete. Use @code{make-hash-table} instead.
 @section Hash Table Access
 
   This section describes the functions for accessing and storing
-associations in a hash table.
+associations in a hash table.  In general, any Lisp object can be used
+as a hash key, unless the comparison method imposes limits.  Any Lisp
+object can also be used as the value.
 
 @tindex gethash
 @defun gethash key table &optional default
@@ -210,7 +213,7 @@ table.
 This function calls @var{function} once for each of the associations in
 @var{table}.  The function @var{function} should accept two
 arguments---a @var{key} listed in @var{table}, and its associated
-@var{value}.
+@var{value}.  @code{maphash} returns @code{nil}.
 @end defun
 
 @node Defining Hash
@@ -279,8 +282,8 @@ compared case-insensitively.
 (defun case-fold-string-hash (a)
   (sxhash (upcase a)))
 
-(define-hash-table-test 'case-fold 'case-fold-string=
-                        'case-fold-string-hash))
+(define-hash-table-test 'case-fold
+  'case-fold-string= 'case-fold-string-hash)
 
 (make-hash-table :test 'case-fold)
 @end example