From: Oliver Bandel <oliver@first.in-berlin.de>
To: Caml-list List <caml-list@inria.fr>
Subject: Re: [Caml-list] Annoying behaviour of OCaml
Date: Thu, 10 Jan 2008 20:48:16 +0100 [thread overview]
Message-ID: <1199994496.4786768086a07@webmail.in-berlin.de> (raw)
In-Reply-To: <4786312A.1050003@functionality.de>
Zitat von Thomas Fischbacher <tf@functionality.de>:
[...]
>
> compare ((17,23),[|8;9;10|]) ((12,21),[|8;9|]);;
17 > 12
This must give back 1.
>
> (* This situation is quite similar to the one where encountered
> the problem. We tried to use Array.sort in conjunction with
> "compare" to sort some abstract specifications of contributions
> to a sparse matrix of the form ((row,column),array_of_factors)
> by row, assuming that "compare" would do the job through
> lexicographical order, but actually, it does not. In this case,
> the result is +1 rather than -1!
> *)
>
> compare ((17,23),[8;9;10]) ((12,21),[8;9]);;
17 > 12
This must give back 1.
>
> Let us see for comparison how other H.M.-typed languages behave:
> Haskell (hugs):
>
> Haskell 98 mode: Restart with command line option -98 to enable
> extensions
>
> Type :? for help
> Hugs.Base> ((17,23),[8,9,10]) < ((12,21),[8,9])
> False
> Hugs.Base>
# compare 1 2;;
- : int = -1
Is -1 to be interpreted as false or as true?
OCaml:
# ((17,23),[8;9;10]) < ((12,21),[8;9]);;
- : bool = false
So it's the same as in Haskell.
So it should be what you expected.
Ciao,
Oliver
prev parent reply other threads:[~2008-01-10 19:48 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
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 [this message]
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=1199994496.4786768086a07@webmail.in-berlin.de \
--to=oliver@first.in-berlin.de \
--cc=caml-list@inria.fr \
/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