From 51a8583a97af6eb637fbcc0b9b63675f20f35039 Mon Sep 17 00:00:00 2001 From: Gattix Date: Sun, 12 Dec 2021 01:14:47 +0100 Subject: [PATCH] day 5: NEEDS MOAR ARROWS --- 2021/day05/day05.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/2021/day05/day05.hs b/2021/day05/day05.hs index 6850407..2278ad5 100644 --- a/2021/day05/day05.hs +++ b/2021/day05/day05.hs @@ -1,12 +1,14 @@ import qualified Data.Map as M import Data.List.Split +import Control.Arrow +import Control.Monad main :: IO () main = do input <- map (map read . filter (/="->")) <$> map (splitOneOf ", ") <$> lines <$> readFile "input" let part1inp = filterOrth input - print $ length $ M.filter (> 1) $ M.fromListWith (+) (toMap part1inp) - print $ length $ M.filter (> 1) $ M.fromListWith (+) (toMap input) + let process = length . M.filter (> 1) . M.fromListWith (+) . toMap + print $ join (***) process $ (filterOrth input,input) filterOrth :: [[Int]] -> [[Int]] filterOrth [] = []