From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA14503; Mon, 5 Nov 2001 13:26:28 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA14551 for ; Mon, 5 Nov 2001 13:26:27 +0100 (MET) Received: from imp.pro.proxad.net (imp1-1.pro.proxad.net [212.27.35.86]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fA5CQQH07067; Mon, 5 Nov 2001 13:26:26 +0100 (MET) Received: by imp.pro.proxad.net (Postfix, from userid 33) id 58BB478100; Mon, 5 Nov 2001 13:26:26 +0100 (MET) To: Xavier Leroy Subject: Re: [Caml-list] Sorting Message-ID: <1004963186.3be685724d991@imp.pro.proxad.net> Date: Mon, 05 Nov 2001 13:26:26 +0100 (MET) From: jeanmarc.eber@lexifi.com Cc: "Marcin 'Qrczak' Kowalczyk" , caml-list@inria.fr References: <20011105102251.C8282@pauillac.inria.fr> In-Reply-To: <20011105102251.C8282@pauillac.inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.42 X-Originating-IP: 193.104.89.65 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk En réponse à Xavier Leroy : > > What are advantages and disadvantages in parametrizing either by '<' > > or by the 3-way comparison? > > In addition to what has been said already, the 3-way comparison is > less error-prone with respect to two classic errors: > 1- passing a "less than or equal" predicate where a "less than" > predicate is expected, or conversely; > 2- passing a predicate that is not a total ordering where a total > ordering is expected. > Both errors could cause the old Sort.array or Sort.list functions to > misbehave seriously. These errors are still possible with the 3-way > comparison approach, but less likely I think. > > - Xavier Leroy When we are just about "sorting predicates": I always have a little hesitation about the properties that are assumed on this functions. Shouldn't one say clearly in the OCaml doc that these comparison function are simply suppposed (if I'm not wrong) to be a total pre-order, that is a binary predicate that is total (of course) transitive reflexive BUT NOT necessarly anti-symetric. Of course, these properties have to be "translated" back into the 3-way comparison approach (thats trivial) but I would find it helpful to say precisely what properties these functions should have. Jean-Marc Eber LexiFi Technologies ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr