我试图让这滴列表的前n项功能:删除前n项
let rec drop n h =
if n == 0 then h else (drop n-1 (match h with a::b -> b));;
这是给:
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
什么是错在这里?这是我在OCAML的第一天(通常是函数式编程),我只是在互联网上阅读手册和教程。我不知道这个消息的含义。
此外,这是需要除函数定义没有用咱们的大作业的一部分,并没有使用额外的库