[r6rs-discuss] Hash function return value constraints
owinebar at gmail.com
Fri Apr 3 16:39:55 EDT 2009
On Fri, Apr 3, 2009 at 10:18 AM, Alex Queiroz <asandroq at gmail.com> wrote:
> On 4/3/09, leppie <xacc.ide at gmail.com> wrote:
> > What is the rationale for making the hash value non-negative?
> Maybe because the output is supposed to be used as an index into
> some hash table array.
Not that I support leppie's idea, but I don't see anything in the R6RS
interface for hashtables that requires the hashtable implementation to
actually implement the standard defintion of a hash table, i.e. based
on an actual table.
Unless I've missed something, you could implement the interface with
trees or even association lists. The hash function is just for making
the underlying mapping (assoc list, tree, standard hash table, etc)
operate on the key domain quotiented by the equivalence relation
induced by the hash function.
I don't know how leppie would apply this to scheme vectors, but it
would certainly be viable for trees and assoc lists.
More information about the r6rs-discuss