From ee975cb56a8e425468ab407962ef5736dfe7ae17 Mon Sep 17 00:00:00 2001 From: shu Date: Sun, 1 Dec 2019 09:37:00 +0100 Subject: [PATCH] Use Ints yay for infix div which I somehow forgot about --- 2019/day1/day1.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2019/day1/day1.hs b/2019/day1/day1.hs index e6cfd87..e236a20 100644 --- a/2019/day1/day1.hs +++ b/2019/day1/day1.hs @@ -6,9 +6,9 @@ main = do day11 :: [String] -> Int -day11 xs = sum $ map ((subtract 2) . floor . (/ 3) . read) xs +day11 xs = sum $ map ((subtract 2) . (`div` 3) . read) xs day12 :: [String] -> Int day12 xs = (sum $ map (f . read) xs) - (sum $ map read xs) where - f x | x>0=x+f (((subtract 2) . floor . (/ 3) . fromIntegral) x) + f x | x>0=x+f (((subtract 2) . (`div` 3)) x) | otherwise = 0