projects
/
advent-of-code-16.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9c8d506
)
Strict fold
author
Neil Smith
<neil.git@njae.me.uk>
Sun, 18 Dec 2016 11:39:17 +0000
(11:39 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Sun, 18 Dec 2016 11:39:17 +0000
(11:39 +0000)
advent18f.hs
patch
|
blob
|
history
diff --git
a/advent18f.hs
b/advent18f.hs
index f643ff54abd004f6501118b8ab935f83bebab93b..a1cd59b8c86902026f641078e511f93b7e0db409 100644
(file)
--- a/
advent18f.hs
+++ b/
advent18f.hs
@@
-1,4
+1,4
@@
-import Data.List (tails)
+import Data.List (tails
, foldl'
)
-- input = "..^^."
-- input = ".^^.^.^^^^"
-- input = "..^^."
-- input = ".^^.^.^^^^"
@@
-10,11
+10,11
@@
main = do
part2
part1 :: IO ()
part2
part1 :: IO ()
-part1 = print $ fst $ foldl nextRowFold (countSafe row, row) [2..40]
+part1 = print $ fst $ foldl
'
nextRowFold (countSafe row, row) [2..40]
where row = readRow input
part2 :: IO ()
where row = readRow input
part2 :: IO ()
-part2 = print $ fst $ foldl nextRowFold (countSafe row, row) [2..400000]
+part2 = print $ fst $ foldl
'
nextRowFold (countSafe row, row) [2..400000]
where row = readRow input
readRow :: String -> [Bool]
where row = readRow input
readRow :: String -> [Bool]