projects
/
advent-of-code-19.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f95e777
)
An slightly different way to approach it
author
Neil Smith
<neil.git@njae.me.uk>
Wed, 4 Dec 2019 08:20:30 +0000
(08:20 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Wed, 4 Dec 2019 08:20:30 +0000
(08:20 +0000)
advent04/src/advent04.hs
patch
|
blob
|
history
diff --git
a/advent04/src/advent04.hs
b/advent04/src/advent04.hs
index ac7c1756ba0db88c4d6badc0f240316625a846a0..d7ec1c858cf711a2e36baa187a7ab9bac087ffba 100644
(file)
--- a/
advent04/src/advent04.hs
+++ b/
advent04/src/advent04.hs
@@
-2,6
+2,7
@@
main :: IO ()
main = do
print part1
+ print part1a
print part2
lowerLimit = 134792
@@
-9,6
+10,10
@@
upperLimit = 675810
part1 = length $ filter inRange $ filter adjacentSame candidates
+part1a = length $ filter (>= lowerLimit)
+ $ filter (<= upperLimit)
+ $ map numify
+ $ filter adjacentSame candidates
part2 = length $ filter inRange $ filter isolatedAdjacentSame candidates
inRange digits = n >= lowerLimit && n <= upperLimit