Closed bayesianbrad closed 6 years ago
The syntax does not seem correct. Try this one.
(let [x (sample (normal 0 1))]
(if (> x 0)
(if (< x 1)
(observe (normal 0.5 1) 1)
(observe (normal 2 1) 1))
(if (> x -1)
(observe (normal -0.5 1) 1)
(observe (normal -2 1) 1)))
x)
@haohaiziround is absolutely correct; basically, there is an if
missing in the code. However, I slightly improved the error message.
If I add the missing if
, it seems to work fine:
(let [x1 (sample (normal 0 1))
x2 (sample (gamma 3 2))]
(if (< x1 x2)
(if (> x1 0)
(observe (normal 1 1) 1)
(observe (normal -1 1) 1))
(if (> x2 1)
(observe (gamma 1 2) 2)
(observe (gamma 3 4) 4 )))
[x1 x2])
For example