[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EQUALP hash tables (and more ...)



The Interlisp-like extension to hash tables that JONL proposes sounds
like a pretty good one to me: allow users to specify their own test
functions, but if they choose anything other than a small set of
"built-in" tests, they have to supply the appropriate numericalizing
function as well.  I'm not sure what the new keyword to make-hash-table
would be.  :numericalize doesn't do much for me.

This is a compatible extension, as long as we allow the user not to
supply the numericalizer if the test is one of EQ, EQL, or EQUAL (and
maybe we add EQUALP).  For EQ, at least, the numericalizer has to be
built in, because we really can't put anything like MAKNUM in the
portable language.

A few other things might be required to round this out.  One is a
keyword that says whether the table has to be rehashed after a GC, as
most implementations now do for EQ hashtables.  This switch would be
ignored in implementations that do not move things during a GC.  We also
probably want to supply the user with a manual REHASH function that takes a
whole hashtable and rehashes it.  For modifying individual keys, we just
have to make clear to the users that they had better remove the item,
alter it, and then put it back.

I'm not sure if we want to make so large an extension to hash tables,
but if we do, this is a compatible way of doing it.

-- Scott