(* Sample OCaml function and testing program -- Pouya Larjani *) let compare (x,y) = if x < y then "smaller than" else if x > y then "greater than" else "equal to";; let test_compare (x,y) = let res = compare (x,y) in print_float x; print_string " is "; print_string res; print_string " "; print_float y; print_newline ();; test_compare (3.0, 1.0);; test_compare (5.0, 5.0);; test_compare (3.1415926535, 22. /. 7.);; (* Signatures: val compare : 'a * 'a -> string = val test_compare : float * float -> unit = *) (* Output: 3. is greater than 1. 5. is equal to 5. 3.1415926535 is smaller than 3.14285714286 *)