Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Sorting
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-11-05 (09:23)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] Sorting
> 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
Bug reports:  FAQ:
To unsubscribe, mail  Archives: