8 ms·
Completely shameless plug for a tiny probabilistic programming language that I wrote as an embedded DSL in Haskell: https://github.com/chris-taylor/hs-probabil
by crntaylor 13y ago
Completely shameless plug for a tiny probabilistic programming language that I wrote as an embedded DSL in Haskell:
https://github.com/chris-taylor/hs-probability https://github.com/chris-taylor/hs-probability
The code that solves this problem is:
solve = do
coin <- choose (999/1000) fair biased
tosses <- replicateM 10 coin
condition (tosses == replicate 10 Head)
nextToss <- coin
return nextToss
where
fair = choose (1/2) Head Tail
biased = certainly Head