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=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 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 CE591BC6B for ; Thu, 10 Jan 2008 18:34:19 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJvlhUfAXQImh2dsb2JhbACQHwEBAQgKKZko X-IronPort-AV: E=Sophos;i="4.24,267,1196636400"; d="asc'?scan'208";a="6506967" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 10 Jan 2008 18:34:19 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m0AHYG7m007633 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 10 Jan 2008 18:34:19 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJvlhUfBMHhLiGdsb2JhbACQHwEBAQgEBhEYmSg X-IronPort-AV: E=Sophos;i="4.24,267,1196636400"; d="asc'?scan'208";a="5917939" Received: from net.univ-savoie.fr ([193.48.120.75]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Jan 2008 18:34:19 +0100 Received: from post.bourget.univ-savoie.fr (post.bourget.univ-savoie.fr [193.48.120.73]) by net.univ-savoie.fr (8.12.3/jtpda-5.4) with ESMTP id m0AHY2oT032394 ; Thu, 10 Jan 2008 18:34:02 +0100 Received: from d45.lama.univ-savoie.fr (d45.lama.univ-savoie.fr [193.48.123.45]) by post.bourget.univ-savoie.fr (8.12.3/jtpda-5.4) with ESMTP id m0AHXv6R017035 ; Thu, 10 Jan 2008 18:33:58 +0100 Message-ID: <47865706.7030806@univ-savoie.fr> Date: Thu, 10 Jan 2008 18:33:58 +0100 From: Christophe Raffalli User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: Thomas Fischbacher Cc: Brian Hurt , Eric Cooper , caml-list@inria.fr Subject: Re: [Caml-list] Annoying behaviour of OCaml References: <4786312A.1050003@functionality.de> <20080110152017.GA513@stratocaster.home> <478639DE.6040903@janestcapital.com> <47863E28.6080803@functionality.de> In-Reply-To: <47863E28.6080803@functionality.de> X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig8F09C6F05FB2842E936FF4CB" X-Scanned-By: MIMEDefang 2.33 (www . roaringpenguin . com / mimedefang) X-Miltered: at discorde with ID 47865718.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; christophe:01 raffalli:01 christophe:01 raffalli:01 univ-savoie:01 ocaml:01 ocaml:01 arrays:01 mylist:01 mylist:01 chablais:01 73376:01 univ-savoie:01 polymorphic:01 rec:01 X-Attachments: type="application/pgp-signature" name="signature.asc" name="signature.asc" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8F09C6F05FB2842E936FF4CB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable >=20 > Well, yes, this is what the manual says and guarantees. However, > everybody does expect lexicographical ordering here. In particular, > it would be natural to have >=20 No, I expect as fast as possible ordering to speed up Sets and Maps as much as possible. It is easy to write in C or in Caml (with Obj) polymorphic lexicographic = comparison if you need it. You could even start with the original compare of OCaml i= n compare.c if I remember well. Now remains the question of having both a "fast_compare" (comparing size = first for both string and arrays which is not the case now) and "lex_compare" in the library ... Bu= t it does not bother me too much. > compare (Array.of_list x) (Array.of_list y) =3D compare x y This would become true if the hd of the list was at the rigth of the tl l= ike in type 'a mylist =3D Nil | Cons of 'a mylist * 'a let rec mylist_to_list =3D function Nil -> [] | Cons(l,x) -> x::mylist_to_list l let my_list_to_array l =3D Array.of_list (mylist_to_list l) let l1 =3D Cons(Nil,1) let l2 =3D Cons(Cons(Nil,2),1) let b =3D compare (my_list_to_array l1) (my_list_to_array l2) =3D compare= l1 l2 So this property is not really that natural. --=20 Christophe Raffalli Universite de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tel: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution can check this signature. The public key is stored on www.keyserver.net --------------------------------------------- --------------enig8F09C6F05FB2842E936FF4CB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHhlcMi9jr/RgYAS4RAnxCAJ9I6Hc9UbRWfJ/vJjDBUAOrpoZ9FQCeMlG4 4v6sO/qsVnQ2ju2lsgMWecE= =gsOL -----END PGP SIGNATURE----- --------------enig8F09C6F05FB2842E936FF4CB--