Guile Mailing List Archive

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

Re: Scheme style auto-resizing hashtable



Maciej Stachowiak <mstachow@mit.edu> writes:

> russell.mcmanus@gs.com writes:
> > Maciej Stachowiak <mstachow@mit.edu> writes:
> > 
> > > Another note: I use both eq? and equal? hashing in my code a fair
> > > bit.  It would be nice if your code were able to hash by any of
> > > eq?, eqv? or equal? (the hashers for the first two should not be
> > > hard).
> > 
> > Why not an arbitrary equality test?
> 
> That would be nice too, but you really need a hash function that
> hashes pairs of objects that satisfy the equivalence predicate to the
> same value, and does its best to avoid collisions otherwise. It might
> be hard for users to come up with one (though probably not
> impossible).
> 
> As an example, suppose I had a set-equal? which tests if two lists
> have equal? elements but possibly in different order. Since this
> equivalence predicate is even broader than eqaul?, using the equal?
> hasher would not give correct semantics (set-equal? keys might not
> hash to the same thing).

I guess we have to support arbitrary equality tests, _and_ a user
supplied hash function ;^)

-russ

--
There are two kinds of people in the world:  people who think there 
are two kinds of people and people who don't.

Guile Home | Main Index | Thread Index