correcting unefficient use of ocaml compare