I just started learning Ocaml and am playing around with recursive functions. Ocaml Compiler is telling me that recursively calling helper in "if h1=h2 then helper t1 t2" causes an error: This expression has type 'a list * 'a list -> bool but an expression was expected of type bool. I understand that it is telling me that the compiler is expecting a boolean but instead gets a function that returns the boolean. But I have no idea how I can fix this. Any help is appreciated
let rec a_func l =
let rec helper tmp l1 = function
| [], [] -> true
| _, [] -> false
| h1::t1, h2::t2 -> if h1=h2 then helper t1 t2 else helper [h2]@l1 t2
in helper [] l