[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EQUALP hash tables (and more ...)
- To: Common-Lisp@SU-AI
- Subject: Re: EQUALP hash tables (and more ...)
- From: Glenn S. Burke <GSB@MIT-MC>
- Date: Sat, 18 May 85 22:15:14 EST
Date: Fri, 17 May 85 21:14 EDT
From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
. . .
One other point: I suspect that rather than specifying the equivalence
function and the hashing function as separate arguments to
MAKE-HASH-TABLE, you would be better off introducing a DEFHASH special
form that defines a new flavor [sic] of hash table. That way, you
package up the equivalence function and the hashing function together
into something that has a name, and you don't have to face the issue of
inconsistent combinations. Furthermore, the DEFHASH for EQ and EQL hash
tables has already been done by the Common Lisp implementation, so you
don't have to publish the name of their implementation-dependent hashing
function.
Yes.
Our CL implementation already uses the :TEST argument to MAKE-HASH-TABLE
as a key looked up in a table of flavors of hash table, but we haven't
told users how to add their own entries to that table.
NIL does likewise. One of the "flavors" of hash table is
functional-hash-table, which is additionally parameterizable by a
function to do error checking on the key (so that it gets caught at
gethash level rather than by the equality or hashing function). There
is also some hair so that the equality function used can be different
from the name used to reference; e.g., hash-tables which use :TEST
#'STRING-EQUAL (one of the hash table tests predefined in NIL)
actually use an internal two-argument-only form of string-equal which
doesn't check its arguments, rather than applying the hairy one which
takes keyworded arguments. All NIL hash tables other than EQ and EQL
are implemented through this (string=, char-equal, string-equal and
equal are predefined).