Source file poly0.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(** Primitives for polymorphic compare. *)
external ( < ) : ('a[@local_opt]) -> ('a[@local_opt]) -> bool = "%lessthan"
external ( <= ) : ('a[@local_opt]) -> ('a[@local_opt]) -> bool = "%lessequal"
external ( <> ) : ('a[@local_opt]) -> ('a[@local_opt]) -> bool = "%notequal"
external ( = ) : ('a[@local_opt]) -> ('a[@local_opt]) -> bool = "%equal"
external ( > ) : ('a[@local_opt]) -> ('a[@local_opt]) -> bool = "%greaterthan"
external ( >= ) : ('a[@local_opt]) -> ('a[@local_opt]) -> bool = "%greaterequal"
external ascending : ('a[@local_opt]) -> ('a[@local_opt]) -> int = "%compare"
external compare : ('a[@local_opt]) -> ('a[@local_opt]) -> int = "%compare"
external equal : ('a[@local_opt]) -> ('a[@local_opt]) -> bool = "%equal"
let descending x y = compare y x
let max x y = Bool0.select (x >= y) x y
let min x y = Bool0.select (x <= y) x y