From: Neil Smith Date: Wed, 1 Dec 2021 16:34:27 +0000 (+0000) Subject: A little point-free tweak X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=a2a16b80400775f291b74d4923a00949fb1b70f1;p=advent-of-code-21.git A little point-free tweak --- 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