From: Christophe Raffalli <christophe.raffalli@univ-savoie.fr>
To: Thomas Fischbacher <tf@functionality.de>
Cc: Brian Hurt <bhurt@janestcapital.com>, Eric Cooper <ecc@cmu.edu>,
caml-list@inria.fr
Subject: Re: [Caml-list] Annoying behaviour of OCaml
Date: Thu, 10 Jan 2008 18:33:58 +0100 [thread overview]
Message-ID: <47865706.7030806@univ-savoie.fr> (raw)
In-Reply-To: <47863E28.6080803@functionality.de>
[-- Attachment #1: Type: text/plain, Size: 1720 bytes --]
>
> 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
>
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 in 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 ... But it does not bother me too
much.
> compare (Array.of_list x) (Array.of_list y) = compare x y
This would become true if the hd of the list was at the rigth of the tl like in
type 'a mylist =
Nil
| Cons of 'a mylist * 'a
let rec mylist_to_list = function
Nil -> []
| Cons(l,x) -> x::mylist_to_list l
let my_list_to_array l = Array.of_list (mylist_to_list l)
let l1 = Cons(Nil,1)
let l2 = Cons(Cons(Nil,2),1)
let b = compare (my_list_to_array l1) (my_list_to_array l2) = compare l1 l2
So this property is not really that natural.
--
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
---------------------------------------------
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
next prev parent reply other threads:[~2008-01-10 17:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-10 14:52 Thomas Fischbacher
2008-01-10 15:00 ` [Caml-list] " Jean-Christophe Filliâtre
2008-01-10 15:07 ` Berke Durak
2008-01-10 15:20 ` Eric Cooper
2008-01-10 15:29 ` Brian Hurt
2008-01-10 15:47 ` Thomas Fischbacher
2008-01-10 17:33 ` Christophe Raffalli [this message]
2008-01-10 20:07 ` Oliver Bandel
2008-01-10 21:52 ` David Thomas
2008-01-10 22:29 ` Oliver Bandel
2008-01-10 22:55 ` David Thomas
2008-01-10 23:02 ` Oliver Bandel
2008-01-10 23:00 ` Oliver Bandel
2008-01-10 15:32 ` Thomas Fischbacher
2008-01-10 19:49 ` Oliver Bandel
2008-01-10 19:48 ` Oliver Bandel
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=47865706.7030806@univ-savoie.fr \
--to=christophe.raffalli@univ-savoie.fr \
--cc=bhurt@janestcapital.com \
--cc=caml-list@inria.fr \
--cc=ecc@cmu.edu \
--cc=tf@functionality.de \
/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