Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Comparison of functional values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Andrieu <andrieu@o...>
Subject: Re: [Caml-list] Comparison of functional values
 Alan Schmitt [Wednesday 7 March 2001] :
 > As stated in http://caml.inria.fr/ocaml/htmlman/manual031.html, != is
 > the negation of ==.

Salut Alan !

I known. But to use the Set functor, you need a `compare' function of
type ('a -> 'a -> int) whereas != and == have type ('a -> bool). 
So != does not seem very helpful here.

What I meant actually, was a «physical compare». I found out that 
this (crude) C function works :

value phys_comp(value a, value b)
{
 if(a<b)
   return Val_int(-1) ;
 else if(a>b)
   return Val_int(+1) ;
 else 
   return Val_int(0);
}

Olivier
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr