2013-01-25 19 views
0

一起使用我无法弄清楚这个错误的含义,我从来没有看到它在 之前所抱怨的那一行是包含x - >让 我之前使用的是匹配,但它仍然给我同样的错误。ocaml错误:该表达式有类型expr,但在这里与类型单元 - > expr

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

+0

没有定义,或者至少是代码片段中所有绑定的声明,很难说。 – didierc

回答

3

也许buildXbuildY应该采取一个参数?

# let f() = 14;; 
val f : unit -> int = <fun> 
# f ;; 
- : unit -> int = <fun> 
# f();; 
- : int = 14 
+0

它们不是:/它有空() –

+1

在OCaml中,empty()是一个值。 –

+0

我猜@JeffreyScofield发现了。 – didierc

相关问题