day 5: NEEDS MOAR ARROWS
This commit is contained in:
parent
e4bae770de
commit
51a8583a97
|
@ -1,12 +1,14 @@
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.List.Split
|
import Data.List.Split
|
||||||
|
import Control.Arrow
|
||||||
|
import Control.Monad
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
input <- map (map read . filter (/="->")) <$> map (splitOneOf ", ") <$> lines <$> readFile "input"
|
input <- map (map read . filter (/="->")) <$> map (splitOneOf ", ") <$> lines <$> readFile "input"
|
||||||
let part1inp = filterOrth input
|
let part1inp = filterOrth input
|
||||||
print $ length $ M.filter (> 1) $ M.fromListWith (+) (toMap part1inp)
|
let process = length . M.filter (> 1) . M.fromListWith (+) . toMap
|
||||||
print $ length $ M.filter (> 1) $ M.fromListWith (+) (toMap input)
|
print $ join (***) process $ (filterOrth input,input)
|
||||||
|
|
||||||
filterOrth :: [[Int]] -> [[Int]]
|
filterOrth :: [[Int]] -> [[Int]]
|
||||||
filterOrth [] = []
|
filterOrth [] = []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user