我正在尝试编写一个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 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>
尝试评估new_Game
时出现以下错误:
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
为什么会出现此错误,我该如何解决?
答案 0 :(得分:0)
seedLife有3个参数,但它只传递了2个。