One-dimensional cellular automata: Difference between revisions
Content added Content deleted
m (removed duplicated line: <lang algol68>INT stop generation = 9;) |
(→{{header|Haskell}}: Dropped liftM2 and ap for the more current Applicatiive liftA2 and <*>) |
||
Line 2,321: | Line 2,321: | ||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang haskell>import |
<lang haskell>import System.Random (newStdGen, randomRs) |
||
import |
import Control.Applicative (liftA2) |
||
import |
import Data.List (unfoldr) |
||
bnd :: String -> Char |
bnd :: String -> Char |
||
Line 2,345: | Line 2,345: | ||
lahmahgaan xs = |
lahmahgaan xs = |
||
init . |
init . |
||
until ( |
until (liftA2 (==) last (last . init)) ((++) <*> (return . donxt . last)) $ |
||
[xs, donxt xs] |
[xs, donxt xs] |
||