0

我不知道这个错误是什么意思,我从来没有见过它抱怨的行之前是否包含 x -> let 我在此之前使用 match with 但它仍然给我同样的错误。

let rec build (rand,depth) = match depth with
 | 0 -> if rand(0,2) == 0 then buildX else buildY
 | x -> let r =  rand(0, 5) in
     if r == 0 then buildSine (build (rand, x -1))
     else if r == 1 then buildCosine (build (rand, x -1))
     else if r == 2 then buildAverage (build (rand,x -1), build (rand,x-1))
     else if r == 3 then buildTimes (build (rand, x -1), build (rand, x-1))
     else buildThresh (build(rand, x-1), build(rand, x-1),               
                   build(rand, x-1), build(rand, x-1));;

我的每个构建都返回一个 expr,这应该构建一个大 expr 任何帮助将不胜感激。提前致谢!:D

4

1 回答 1

3

也许buildX并且buildY应该争论?

# let f () = 14;;
val f : unit -> int = <fun>
# f ;;
- : unit -> int = <fun>
# f ();;
- : int = 14
于 2013-01-25T00:13:08.523 回答