caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matthias Puech <puech@cs.unibo.it>
To: caml-list@yquem.inria.fr
Subject: Sets and home-made ordered types
Date: Wed, 16 Sep 2009 18:40:49 +0200	[thread overview]
Message-ID: <4AB11511.2050506@cs.unibo.it> (raw)

Dear Camlists,

This is my first post on this list, so please excuse me if it is too 
vague/off-topic/already discussed... I've been asking myself this 
question about the standard library's Set for quite a while.

The ability of the module Set to take an order (compare) as input, 
possibly larger than Pervasive's one, allows for some valuable tricks, 
i.e. assure that a set contains at most one element of each equivalence 
class. This element is actually stored in the structure, but then it 
seems not possible to retreive it (efficiently): the only interaction is 
to test if some element of the same equivalence class is present, with 
mem : elt -> t -> bool.

My question is : why isn't there a function find : elt -> t -> elt, 
where find e s would return the stored element  e' s.t compare e e' = 1 
? These two elements can be interestingly distinct though...

Thanks in advance for all enlightenment.

    --Matthias

PS: Of course I don't want to fold, filter or such, for efficiency 
reasons...


             reply	other threads:[~2009-09-16 16:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16 16:40 Matthias Puech [this message]
     [not found] ` <002e01ca36fd$37656c60$a6304520$@metastack.com>
2009-09-16 21:38   ` [Caml-list] " Matthias Puech
2009-09-17  3:05     ` [Caml-list] " Damien Guichard
2009-09-17  7:31     ` [Caml-list] " Vincent Aravantinos
2009-09-17  8:39     ` David Allsopp
2009-09-23 10:46     ` Goswin von Brederlow
     [not found] <20090917030607.927BCBCA9@yquem.inria.fr>
2009-09-17  6:21 ` Caml-list] " CUOQ Pascal
2009-09-17  8:45   ` [Caml-list] " Matthias Puech
2009-09-17  9:07     ` CUOQ Pascal

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=4AB11511.2050506@cs.unibo.it \
    --to=puech@cs.unibo.it \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).