[MLton-devel] Porting from Moscow ML

Stephen Weeks MLton@mlton.org
Mon, 23 Sep 2002 10:28:25 -0700

> I'm now working on my first-order library, and I've reached another
> stopping point: the Polyhash module. Is there anything like this
> available for MLton, or should I recode using something like
> Binarymap (which I've already ported from Moscow ML)?

It looks easy enough to me to port all of Polyhash except for the
polymorphic hash primitives (hash_param, hash, mkPolyTable).  You only
need word primitives (Word32.and, Word32.<<), which MLton has.  We
have a similar hash table implementation in our library (in the
sources, see lib/mlton/basic/hash-set.{sig,sml}).

If you need the polymorphic hash primitives, I would recommend the
approach we use in MLton.  In objects that need a hash value and there
is no obvious way to compute one, add an extra word that is randomly
chosen when the object is created, and use that as a hash value with
the hash table implementation.

This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
MLton-devel mailing list