Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Harrison, John R" <john.r.harrison@intel.com>
To: Berke Durak <berke.durak@exalead.com>,
	Caml-list List <caml-list@inria.fr>
Subject: RE: [Caml-list] Canonical Set/Map datastructure?
Date: Wed, 5 Mar 2008 10:34:21 -0700	[thread overview]
Message-ID: <DCC19446A892D84FBB89AE7C94F0C04E01D98971DD@azsmsx501.amr.corp.intel.com> (raw)
In-Reply-To: <47CECF23.1020508@exalead.com>

Hi Berke,

| Does anyone know if, in the many years that have passed since the
| implementation of those fine modules, someone has invented a
| (functional) datastructure that is as efficient while being
| canonic?

I have an implementation, which you're welcome to use/adapt. It's
certainly not particularly well optimized, but I've relied on it
for a few years with no problems. The code is in this file:

  http://www.cl.cam.ac.uk/~jrh13/atp/OCaml/lib.ml

Search for "Diego" and the relevant stuff starts there; a few
earlier functions (like "uniq") are used, but they are easy to
copy or replace.

This was the outcome of a similar question I asked on the OCaml
list a few years ago. Diego Olivier Fernandez Pons not only
pointed me at some interesting theoretical results, but also
suggested an idea using hashes and Patricia trees that works very
well in practice. That's what I implemented. My implementation
is for maps only, but it's easy to adapt for sets. Or you could
just use maps to type "unit" if you're lazy like me.

John.


  parent reply	other threads:[~2008-03-05 17:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 16:49 Berke Durak
2008-03-05 17:16 ` [Caml-list] " Brian Hurt
2008-03-05 17:27 ` Alain Frisch
2008-03-05 19:53   ` Jean-Christophe Filliâtre
2008-03-05 20:03   ` Jon Harrop
2008-03-05 21:56     ` Alain Frisch
2008-03-06  7:45     ` Jean-Christophe Filliâtre
2008-03-05 17:34 ` Harrison, John R [this message]
2008-03-06  9:53 ` Berke Durak
2008-03-06 17:36   ` Harrison, John R
2008-03-07 10:09     ` Berke Durak
2008-03-07 17:13       ` Harrison, John R
2008-03-07 10:19   ` Alain Frisch

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=DCC19446A892D84FBB89AE7C94F0C04E01D98971DD@azsmsx501.amr.corp.intel.com \
    --to=john.r.harrison@intel.com \
    --cc=berke.durak@exalead.com \
    --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