From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 41725BC37 for ; Wed, 16 Sep 2009 18:42:34 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAPuxsEqCiAFm/2dsb2JhbADgSIQXBQ X-IronPort-AV: E=Sophos;i="4.44,398,1249250400"; d="scan'208";a="36213871" Received: from leb.cs.unibo.it ([130.136.1.102]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 16 Sep 2009 18:42:34 +0200 Received: from ssl.cs.unibo.it (ssl.cs.unibo.it [127.0.0.1]) (Authenticated sender: hidden) by leb.cs.unibo.it (Postfix) with ESMTPSA id 6EA882359 for ; Wed, 16 Sep 2009 18:42:33 +0200 (CEST) Message-ID: <4AB11511.2050506@cs.unibo.it> Date: Wed, 16 Sep 2009 18:40:49 +0200 From: Matthias Puech User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Sets and home-made ordered types Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; unibo:01 home-made:01 elt:01 bool:01 elt:01 off-topic:02 interaction:02 matthias:02 equivalence:03 equivalence:03 seems:03 module:03 element:03 element:03 types:05 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...