Function OCaml函数类型问题
我正在尝试编写一个Caml函数,但在键入时遇到了一些问题。功能是:Function OCaml函数类型问题,function,functional-programming,ocaml,caml,Function,Functional Programming,Ocaml,Caml,我正在尝试编写一个Caml函数,但在键入时遇到了一些问题。功能是: let new_game size count gens = let rec continueGame board = function 0 -> () |n -> drawBoard board size; continueGame (nextGeneration board) (n-1) in continueGame (seedLife (matrix 0 si
let new_game size count gens =
let rec continueGame board = function
0 -> ()
|n -> drawBoard board size;
continueGame (nextGeneration board) (n-1)
in
continueGame (seedLife (matrix 0 size) count) (gens) ;;
以下是其他功能的类型:
val drawBoard : int list list -> int -> unit = <fun>
val seedLife : int list list -> int -> int -> int list list = <fun>
val nextGeneration : int list list -> int list list = <fun>
val matrix : 'a -> int -> 'a list list = <fun>
为什么会发生此错误?我如何解决它?seedLife接受3个参数,但只传递了2个
continueGame (seedLife (matrix 0 size) count) (gens);;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This expression has type int -> int list list
but is here used with type int list list