Polymorphic comparison

Franck.Delaplace@lri.fr
Tue, 18 Oct 94 13:46:56 +0100

Date: Tue, 18 Oct 94 13:46:56 +0100
From: Franck.Delaplace@lri.fr
Message-Id: <9410181246.AA00288@sun7c.lri.fr>
To: caml-list@pauillac.inria.fr
Subject: Polymorphic comparison

>I think this polymorphic comparison is quite easy to implement in the
>following way:

>#open "hashtbl";;
>let c x y = (hash x) <= (hash y);;
>

this kind of comparison would not be appropriate in some cases.
for example when you want to use it for sorting strings

c "ace" "af";;

gives

- : bool = false

by convention, we intend to have this relation "ace" <= "af" since the comparison is defined
by comparing the substrings "ac" "af"