X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a64bfdfa5a90731b804c057f2bcc74a8ba02937c..732fd4c7e11debd61c97eaaba3038d61e6ec7024:/doc/lispref/hash.texi diff --git a/doc/lispref/hash.texi b/doc/lispref/hash.texi index 0d77cba6fa..bfa60e0d2a 100644 --- a/doc/lispref/hash.texi +++ b/doc/lispref/hash.texi @@ -1,9 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. -@c Copyright (C) 1999, 2001-2011 Free Software Foundation, Inc. +@c Copyright (C) 1999, 2001-2015 Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. -@setfilename ../../info/hash -@node Hash Tables, Symbols, Sequences Arrays Vectors, Top +@node Hash Tables @chapter Hash Tables @cindex hash tables @cindex lookup tables @@ -74,14 +73,14 @@ alternatives: @item eql Keys which are numbers are ``the same'' if they are @code{equal}, that is, if they are equal in value and either both are integers or both -are floating point numbers; otherwise, two distinct objects are never -``the same.'' +are floating point; otherwise, two distinct objects are never +``the same''. @item eq Any two distinct Lisp objects are ``different'' as keys. @item equal -Two Lisp objects are ``the same,'' as keys, if they are equal +Two Lisp objects are ``the same'', as keys, if they are equal according to @code{equal}. @end table @@ -129,13 +128,13 @@ doing that takes some extra time. The default size is 65. @item :rehash-size @var{rehash-size} -When you add an association to a hash table and the table is ``full,'' +When you add an association to a hash table and the table is ``full'', it grows automatically. This value specifies how to make the hash table larger, at that time. If @var{rehash-size} is an integer, it should be positive, and the hash table grows by adding that much to the nominal size. If -@var{rehash-size} is a floating point number, it had better be greater +@var{rehash-size} is floating point, it had better be greater than 1, and the hash table grows by multiplying the old size by that number. @@ -144,7 +143,7 @@ The default value is 1.5. @item :rehash-threshold @var{threshold} 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 +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 @@ -189,6 +188,8 @@ Such objects may be added to the hash table after it is created. @node Hash Access @section Hash Table Access +@cindex accessing hash tables +@cindex hash table access This section describes the functions for accessing and storing associations in a hash table. In general, any Lisp object can be used @@ -263,11 +264,11 @@ will use @var{test-fn} to compare key values, and @var{hash-fn} to compute a ``hash code'' from a key value. The function @var{test-fn} should accept two arguments, two keys, and -return non-@code{nil} if they are considered ``the same.'' +return non-@code{nil} if they are considered ``the same''. The function @var{hash-fn} should accept one argument, a key, and return an integer that is the ``hash code'' of that key. For good results, the -function should use the whole range of integer values for hash codes, +function should use the whole range of integers for hash codes, including negative integers. The specified functions are stored in the property list of @var{name} @@ -294,7 +295,7 @@ compared case-insensitively. @example (defun case-fold-string= (a b) - (compare-strings a nil nil b nil nil t)) + (eq t (compare-strings a nil nil b nil nil t))) (defun case-fold-string-hash (a) (sxhash (upcase a)))