seedLife takes 3 arguments, but it's only passed 2.
OCaml function typing issue
-
30-06-2022 - |
Question
I'm trying to write a Caml function and I'm having a few troubles with the typing. The function is :
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) ;;
Here are the types of other functions :
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>
When trying to evaluate new_Game
I have the following error :
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
Why is this error occuring and how can I resolve it?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow