Browse thread
Annoying behaviour of OCaml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Oliver Bandel <oliver@f...> |
| Subject: | Re: [Caml-list] Annoying behaviour of OCaml |
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