I'm trying to make a function which drops the first n items of a list:
let rec drop n h =
if n == 0 then h else (drop n-1 (match h with a::b -> b));;
This is giving:
Characters 43-49:
if n == 0 then h else (drop n-1 (match h with a::b -> b));;
^^^^^^
Error: This expression has type 'a -> 'b but is here used with type int
What is wrong here? This is my first day in OCAML (with functional programming in general), i'm just following manuals and tutorials on the internet. I've no idea what this message means.
Also, this is a part of a larger homework which requires no use of Let except function definitions, and no use of extra libraries