Fix link colorization
[clqr.git] / clqr-hash-tables.tex
blobb9a3fea5d25b8defc8ed60d8bf6c11b910a04ca8
1 % Copyright (C) 2008, 2009, 2012, 2014 Bert Burgemeister
3 % Permission is granted to copy, distribute and/or modify this
4 % document under the terms of the GNU Free Documentation License,
5 % Version 1.2; with no Invariant Sections, no Front-Cover Texts and
6 % no Back-Cover Texts. For details see file COPYING.
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10 \section{Hash Tables}
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 The Loop Facility provides additional hash table-related
13 functionality; see \kwd{loop}, page \pageref{section:Loop Facility}.
15 Key-value storage similar to hash tables can as well be achieved using
16 association lists and property lists; see
17 pages \pageref{section:Association Lists} and \pageref{:property_lists}.
20 \begin{LIST}{1cm}
22 \IT{(\FU*{HASH-TABLE-P} \VAR{foo})}
24 Return \retval{\T} if \VAR{foo} is of type \kwd{hash-table}.
27 \IT{(\FU*{MAKE-HASH-TABLE}
28 \orGOO{\kwd{:test }\Goo{\FU{eq}\XOR \FU{eql}\XOR
29 \FU{equal} \XOR \FU{equalp}}\DF{\kwd{\#'eql}}\\
30 \kwd{:size} \VAR{ int}\\
31 \kwd{:rehash-size} \VAR{ num}\\
32 \kwd{:rehash-threshold} \VAR{ num}}{\}})}
34 Make a \retval{hash table}.
37 \IT{(\FU*{GETHASH} \VAR{key} \VAR{hash-table} \Op{\VAR{default}\DF{\NIL}})}
39 Return \retval{object} with \VAR{key} if any or \retval{\VAR{default}}
40 otherwise; and \retvalii{\T} if found, \retvalii{\NIL}
41 otherwise. \kwd{setf}able.
44 \IT{(\FU*{HASH-TABLE-COUNT} \VAR{hash-table})}
46 \retval{Number of entries} in \VAR{hash-table}.
49 \IT{(\FU*{REMHASH} \VAR{key} \DES{\VAR{hash-table}})}
51 Remove from \VAR{hash-table} entry with \VAR{key} and return
52 \retval{\T} if it existed. Return \retval{\NIL} otherwise.
55 \IT{(\FU*{CLRHASH} \DES{\VAR{hash-table}})}
57 Empty \retval{\VAR{hash-table}}.
60 \IT{(\FU*{MAPHASH} \VAR{function} \VAR{hash-table})}
62 Iterate over \VAR{hash-table} calling \VAR{function} on key
63 and value. Return \retval{\NIL}.
66 \IT{(\MC*{WITH-HASH-TABLE-ITERATOR} (\VAR{foo} \VAR{hash-table})
67 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
69 Return \retval{values of \VAR{form}s}. In \VAR{form}s,
70 invocations of (\VAR{foo}) return: \T\ if an entry is returned;
71 its key; its value.
74 \IT{(\FU*{HASH-TABLE-TEST} \VAR{hash-table})}
76 \retval{Test function} used in \VAR{hash-table}.
79 \IT{\arrGOO{(\FU*{HASH-TABLE-SIZE} \VAR{ hash-table})\\
80 (\FU*{HASH-TABLE-REHASH-SIZE} \VAR{ hash-table})\\
81 (\FU*{HASH-TABLE-REHASH-THRESHOLD} \VAR{ hash-table})}{.}}
83 Current \retval{size}, \retval{rehash-size}, or
84 \retval{rehash-threshold}, respectively, as used in \FU{make-hash-table}.
87 \IT{(\FU*{SXHASH} \VAR{foo})}
89 \retval{Hash code} unique for any argument \FU{equal} \VAR{foo}.
92 \end{LIST}
96 %%% Local Variables:
97 %%% mode: latex
98 %%% TeX-master: "clqr"
99 %%% End: