From 7573a23e4b063f579292be9ee5b07d46029e47ac Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Sun, 18 Dec 2016 11:39:17 +0000 Subject: [PATCH] Strict fold --- advent18f.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advent18f.hs b/advent18f.hs index f643ff5..a1cd59b 100644 --- a/advent18f.hs +++ b/advent18f.hs @@ -1,4 +1,4 @@ -import Data.List (tails) +import Data.List (tails, foldl') -- input = "..^^." -- input = ".^^.^.^^^^" @@ -10,11 +10,11 @@ main = do 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 () -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] -- 2.34.1