Intersecting number wheels: Difference between revisions
m
→{{header|Haskell}}: (extended output)
m (→{{header|Haskell}}: (extended output)) |
|||
Line 466:
main :: IO ()
main = do
let wheelSets =
[ [('A', "123")]▼
, [('A', "1B2"), ('B', "34")]▼
, [('A', "1DD"), ('D', "678")]▼
, [('A', "1BC"), ('B', "34"), ('C', "5B")]▼
]
putStrLn "State of each wheel-set after 20 clicks:\n"
mapM_ print $
fmap
(flip (mapAccumL (const . clockWorkTick))
▲ [ [('A', "123")]
wheelSets
▲ , [('A', "1B2"), ('B', "34")]
putStrLn "\nInitial state of the wheel-sets:\n"
▲ , [('A', "1DD"), ('D', "678")]
mapM_ print wheelSets</lang>
▲ , [('A', "1BC"), ('B', "34"), ('C', "5B")]
{{Out}}
<pre>State of each wheel-set after 20 clicks:
<pre>(fromList [('A',"312")],"12312312312312312312")▼
(fromList [('A',"21B"),('B',"43")],"13214213214213214213")
(fromList [('A',"D1D"),('D',"786")],"16718617816718617816")
(fromList [('A',"C1B"),('B',"34"),('C',"5B")],"13514314513413514314")
Initial state of the wheel-sets:
[('A',"123")]
[('A',"1B2"),('B',"34")]
[('A',"1DD"),('D',"678")]
[('A',"1BC"),('B',"34"),('C',"5B")]</pre>
=={{header|Julia}}==
|