I'm trying to pass a function as parameter to another function but I get an error at compilation.
Error: This function has type 'a -> 'a -> int
It is applied to too many arguments; maybe you forgot a `;'.
My code is:
let sort to_do my_list =
let rec change to_do my_list verify newlist = match my_list with
| Empty -> if verify = newlist then newlist else
change to_do newlist newlist Empty
| Item (elem, next) -> change to_do my_list verify (compare to_do elem newlist)
in
change to_do my_list my_list Empty
;;
let rec compare to_do elem my_list = match my_list with
| Empty -> (elem, my_list)
| Item (elem1, Empty) -> if to_do elem elem1 > 0 then Item (elem, elem1) else
Item (elem1, elem)
| Item (elem1, next) -> compare to_do elem next
;;
EmptyandItemvariants?