I have defined some types:
type box = Box of int type table = Table of int type compare_result = Lt | Eq | Gt
It seems that in OCaml we cannot define 2 functions with the same name but with different types of arguments:
let compare (a: box) (b: box): compare_result = (...) let compare (a: table) (b: table): compare_result = (...) let res_box = compare (Box 1) (Box 2) in (* which is supposed to call the first funciton *) let res_table = compare (Table 1) (Table 2) in (* which is supposed to call the second function *)
So can anyone tell me what is the alternative in OCaml for this? Should we call these 2 functions in different ways?
source share