From a2a16b80400775f291b74d4923a00949fb1b70f1 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Wed, 1 Dec 2021 16:34:27 +0000 Subject: [PATCH] A little point-free tweak --- advent01/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advent01/Main.hs b/advent01/Main.hs index 535fdf4..9d62726 100644 --- a/advent01/Main.hs +++ b/advent01/Main.hs @@ -12,7 +12,7 @@ part1 = countIncreasing 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 nums = length $ filter (> 0) $ zipWith (-) (tail nums) nums -- 2.34.1