0

I can't figure out what this error means, I've never seen if before the line it is complaining about is the line that contains x -> let I was using match with before this but it was still giving me the same error.

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

each of my the builds returns a expr and this is supposed to build one big expr Any help would be greatly appreciated. Thanks in advance! :D

Charles Haro
  • 1,866
  • 3
  • 22
  • 36
  • without the definitions, or at least the declarations of all the bindings in your code snippet, it's difficult to tell. – didierc Jan 25 '13 at 02:18

1 Answers1

3

Perhaps buildX and buildY are supposed to take an argument?

# let f () = 14;;
val f : unit -> int = <fun>
# f ;;
- : unit -> int = <fun>
# f ();;
- : int = 14
Jeffrey Scofield
  • 65,646
  • 2
  • 72
  • 108