diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Day1.idr | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/Day1.idr b/src/Day1.idr index 9018a95..96cf777 100644 --- a/src/Day1.idr +++ b/src/Day1.idr @@ -18,9 +18,6 @@ parseStr str = do nums <- lines str maybe [] pure (parsePair nums) -transposePairs : List (a, b) -> (List a, List b) -transposePairs ls = (map fst ls, map snd ls) - part1 : (List Int, List Int) -> Int part1 inp = sum $ zipWith (\x => \y => abs (x - y)) (sort $ fst inp) (sort $ snd inp) @@ -34,5 +31,5 @@ main : IO () main = do estr <- readFile "data/day1.txt" str <- either (die . show) pure estr - putStrLn $ show $ part1 $ transposePairs $ parseStr str - putStrLn $ show $ part2 $ transposePairs $ parseStr str + putStrLn $ show $ part1 $ unzip $ parseStr str + putStrLn $ show $ part2 $ unzip $ parseStr str |