caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Sets and home-made ordered types
@ 2009-09-16 16:40 Matthias Puech
       [not found] ` <002e01ca36fd$37656c60$a6304520$@metastack.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Matthias Puech @ 2009-09-16 16:40 UTC (permalink / raw)
  To: caml-list

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...


^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <20090917030607.927BCBCA9@yquem.inria.fr>]

end of thread, other threads:[~2009-09-23 10:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-16 16:40 Sets and home-made ordered types Matthias Puech
     [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

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).