From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] EQ hash tables?
Date: Wed, 12 Oct 2005 09:41:58 +0200 [thread overview]
Message-ID: <rlek6r41x5.fsf@ithif59.inf.tu-dresden.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0510111652370.10250@katrin.cip.physik.uni-muenchen.de>
Thomas Fischbacher <Thomas.Fischbacher@Physik.Uni-Muenchen.DE> writes:
Actually, this brings me to a question I wanted to ask for a long time:
while I never used this so far, I just assumed that OCaml does provide
hash tables where keys are compared w.r.t. "being the same" ('==' , that
is), rather than only hash tables where keys are compared for "being
equal" (say, '=').
Just look at hash.ml:
let find h key =
match h.data.((hash key) mod (Array.length h.data)) with
Empty -> raise Not_found
| Cons(k1, d1, rest1) ->
if compare key k1 = 0 then d1 else
^^^^^^^^^^^^^^^^^^
So it's structual equality, which is the same as '=' modulo the
float nan issue.
Bye,
Hendrik
next prev parent reply other threads:[~2005-10-12 7:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-10 13:42 [Caml-list] possible to define a type where = is forbidden ? yoann padioleau
2005-10-10 15:04 ` Thomas Fischbacher
2005-10-11 14:56 ` EQ hash tables? Thomas Fischbacher
2005-10-12 7:41 ` Hendrik Tews [this message]
2005-10-12 8:02 ` [Caml-list] " Xavier Leroy
2005-10-12 11:11 ` Thomas Fischbacher
2005-10-12 15:06 ` Xavier Leroy
2005-10-12 17:53 ` Thomas Fischbacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=rlek6r41x5.fsf@ithif59.inf.tu-dresden.de \
--to=tews@tcs.inf.tu-dresden.de \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox