Version française
Home     About     Download     Resources     Contact us    
Browse thread
Polymorphic comparison
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Judicael.Courant@l...
Subject: Polymorphic comparison
Hello,

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

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


#3 c true;;
- : bool = true
#[ "hello" ; "world" ] c 3.14159;;
- : bool = false


But, as Pierre Weis, I am wondering what to do with such a function...

Maybe
let c (x:'a) (y:'a) = (hash x) <= (hash y);;
would be more suitable ?

-- 
Judicaël COURANT           tel. : 72 72 85 82
ENSL - LIP                 email : Judicael.Courant@ens-lyon.fr
46, allée d'Italie
69364 Lyon cedex 07
--