should hash function upper bound be exclusive? Per Bothner (09 Aug 2005 17:31 UTC)
Re: should hash function upper bound be exclusive? Per Bothner (10 Aug 2005 04:52 UTC)
Re: should hash function upper bound be exclusive? Panu Kalliokoski (10 Aug 2005 06:36 UTC)

Re: should hash function upper bound be exclusive? Panu Kalliokoski 10 Aug 2005 06:36 UTC

On Tue, Aug 09, 2005 at 10:31:29AM -0700, Per Bothner wrote:
> Current the 'bound' for hash functions is exclusive: the returned hash h
> is such that (and (>= 0 h) (< h bound)).  One might want the default
> bound to be such that hashes range over the positive fixnums.  But in
> that case the bound would not be a fixnum: it would have to be one
> larger than the largest fixnum.

I think this is an implementation detail.  If one wants hashes that
range over the positive fixnums, one should definitely not try to find
out the maximum fixnum and give that as a bound to (hash), but just use
(hash) without a bound -- that is, with the default bound.  The SRFI has
been written to account exactly for this situation (even if one can't
say anything very precise about it): it leaves for the implementation to
pick a good default bound when the user supplies none.

Besides, even if people did explicitly request a total-fixnumber-range
hash, it would do no harm to leave just a few fixnum values out.

So unless there are reasons like API intuitiveness for changing the
bound parameter to be inclusive, I'll refrain from making changes.

Panu

--
personal contact: xxxxxx@iki.fi, +35841 5323835, +3589 85619369
work contact: xxxxxx@helsinki.fi, +35850 3678003
kotisivu (henkkoht):	http://www.iki.fi/atehwa/
homepage (technical):	http://sange.fi/~atehwa/