projects
/
advent-of-code-21.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed arithmetic
[advent-of-code-21.git]
/
advent01
/
Main.hs
diff --git
a/advent01/Main.hs
b/advent01/Main.hs
index 535fdf45410bf4884cc4103e426c6e25c079b69a..a52bf9c1a6bd597c69118aab6f859eb5eb1cb3af 100644
(file)
--- a/
advent01/Main.hs
+++ b/
advent01/Main.hs
@@
-12,7
+12,8
@@
part1 = countIncreasing
part2 :: [Int] -> Int
part2 nums = countIncreasing $ map sum windows
part2 :: [Int] -> Int
part2 nums = countIncreasing $ map sum windows
- where windows = filter (
\w -> length w == 3
) $ map (take 3) $ tails nums
+ where windows = filter (
(== 3) . length
) $ map (take 3) $ tails nums
countIncreasing :: [Int] -> Int
countIncreasing :: [Int] -> Int
-countIncreasing nums = length $ filter (> 0) $ zipWith (-) (tail nums) nums
+-- countIncreasing nums = length $ filter (> 0) $ zipWith (-) (tail nums) nums
+countIncreasing nums = length $ filter (uncurry (>)) $ zip (tail nums) nums