Debian Codegraph @

tests/prob_prog/functions/1/Test.hs

raw
1 module Test where
2
3 import Probability
4
5 cumsum xs = go 0 xs where
6 go acc [] = []
7 go acc (y : ys) = let acc' = acc + y in acc' : go acc' ys
8
9 model = do
10 z1 <- sample $ iid 3 (poisson 1.0)
11 let z2 = [1 .. 3] :: [Int]
12 let z3 = replicate 3 0 :: [Int]
13
14 -- print(z1)
15 -- print(z2)
16 -- print(z3)
17
18 let x = [1, 2, 3] :: [Int]
19
20 let y1 = cumsum x
21
22 -- we should be able to do functions of data structures with random fields
23 let w1 = cumsum z1
24
25 return ["z1" %=% z1, "z2" %=% z2, "z3" %=% z3, "x" %=% x, "y1" %=% y1, "w1" %=% w1]
26
27 main dirname = do
28 return model