We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 724b42b commit 41a58d8Copy full SHA for 41a58d8
2016/18/haskell/18.hs
@@ -0,0 +1,10 @@
1
+iter xs = aux ('.' : xs ++ ".")
2
+ where
3
+ aux (a : b : c : xs) = (if a == c then '.' else '^') : aux (b : c : xs)
4
+ aux _ = []
5
+
6
+main = do
7
+ let input = "^.^^^.^..^....^^....^^^^.^^.^...^^.^.^^.^^.^^..^.^...^.^..^.^^.^..^.....^^^.^.^^^..^^...^^^...^...^."
8
+ let rows = iterate iter input
9
+ print $ length $ filter (== '.') $ concat $ take 40 rows
10
+ print $ length $ filter (== '.') $ concat $ take 400000 rows
0 commit comments