Anonymous user
Sleeping Beauty problem: Difference between revisions
m
→{{header|Haskell}}: small simplification
(→{{header|Haskell}}: added solution) |
m (→{{header|Haskell}}: small simplification) |
||
Line 312:
data Toss = Heads | Tails deriving Show
moreWakenings <>
case toss of
where
▲ anExperiment toss = moreWakenings <>
▲ Heads -> headsOnWaking
▲ Tails -> moreWakenings
moreWakenings = (1,0)
headsOnWaking = (0,1)
Line 323:
main = do
tosses <- map (bool Heads Tails) <$> replicateM 1000000 randomIO
let (Sum w, Sum h) =
let ratio = fromIntegral h / fromIntegral w
putStrLn $ "Ratio: " ++ show ratio</lang>
|