[ocaml] rewrite codes to remove Map:cardinal to be compatible with OCaml 3.x