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

Re: [Scheme-reports] Seeking review of sets and hash tables proposals



Alaric Snell-Pym scripsit:

> What is the use-case for user-defined hash functions?
> 
> I can see a few:
> 
> 1) Hashing objects not supported usefully by the usual hash function,
> such as things implemented as closures.

Good luck with that.  Unless you have magic (and non-portable) ways of
dissecting closures, of course.

> 2) Hashing things that can already be hashed, but we want to make some
> of them equivalent; considering some elements of a vector or record as
> irrelevant, for instance.

This, I think, is the dominant use case: where you want an equivalence
function coarser, in the sense of the first paragraph of 6.1, than `equal?`.

> 3) You're a cryptographer or similar and have designed an awesome hash
> functions that's faster/less collision-prone/whatever.

Yes, well, whatever.

I think the only safe strategies are either to just make the contract of
the hash function be to return an exact integer (maybe an exact non-negative
integer?), or else to pass a second argument which is its limit.

-- 
John Cowan              cowan@x          http://www.ccil.org/~cowan
Any day you [see] all five woodpeckers is a good day.  --Elliotte Rusty Harold

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports