From: Jean-Christophe Filliatre <filliatr@lri.fr>
To: Tom Hawkins <tom@confluent.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Physical compare
Date: Thu, 24 Nov 2005 16:33:45 +0100 [thread overview]
Message-ID: <17285.56665.713104.465830@gargle.gargle.HOWL> (raw)
In-Reply-To: <4384C0E3.5030300@confluent.org>
Hello,
Tom Hawkins writes:
> Is their a version of "compare" that is based on physical equality? If
> not, how can I define one? I tried:
>
> let compareq a b = if a == b then 0 else if a > b then 1 else (-1)
>
> But unfortunately, (>) is a structural comparison.
>
> I need to make a Map where the keys are distinguished by the physical
> instance.
Others already gave the right answer i.e. that you need to tag your
values with unique integers to do that.
Just to mention it, I wrote a little hash-consing library that does
precisely this, together with specialized versions of Set and Map for
these tagged values (based on Patricia trees). There is even a short
article describing the technique. All is available on this page:
http://www.lri.fr/~filliatr/software.en.html
Hope this helps,
--
Jean-Christophe Filliâtre (http://www.lri.fr/~filliatr)
prev parent reply other threads:[~2005-11-24 15:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-23 19:20 Tom Hawkins
2005-11-23 19:38 ` [Caml-list] " Jon Harrop
2005-11-23 19:49 ` Nicolas Cannasse
2005-11-24 15:33 ` Jean-Christophe Filliatre [this message]
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=17285.56665.713104.465830@gargle.gargle.HOWL \
--to=filliatr@lri.fr \
--cc=caml-list@inria.fr \
--cc=tom@confluent.org \
/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