Skip to content
Snippets Groups Projects
Commit a36e825f authored by meejah's avatar meejah
Browse files

part2

parent e990c5e5
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ module Main where
main = do
contents <- readFile "input-1"
print (whichFloor contents)
print (part2 (lander contents))
santa '(' = 1
......@@ -11,3 +12,12 @@ santa ')' = -1
santa _ = 0
whichFloor xs = sum (map santa xs)
-- part two; take stuff out of list until we reach -1
-- fold == reduce, mostly
isPositive x = x >= 0
part2 x = length (takeWhile isPositive x)
lander x = scanl (+) 0 (map santa x)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment