2013-10-10 2 views
1

Caml 함수를 작성하려고하는데 타이핑에 몇 가지 문제가 있습니다. 이 기능은 다음과 같습니다 여기 OCaml 함수 타이핑 문제

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) ;; 

다른 기능의 종류 :

나는 다음과 같은 오류가 new_Game을 평가하려고
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> 

:

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

seedLife는 3 개의 인수를 취하지 만 2를 통과했습니다.

+0

오 감사합니다. – user26830