I know this could be stupid question, but since I'm new to Ocaml, please give me some tips on defining functions with specific type.
I want to define function which type has int * int * (int -> int) -> int
So I made a function like this.
let rec sigma a b func:int->int=
if a >= b then func(a)
else func(a) + sigma(a+1, b, func)
But sigma function here does not have type int * int * (int->int) -> int
. Instead its type is int->int->(int->int)->int.
How should I define function sigma to have type int * int * (int->int) -> int
?
(Error Message :
Error: This expression has type 'a * 'b * 'c
but an expression was expected of type int