cleanup
This commit is contained in:
parent
cec5485fda
commit
9bbd9d8088
|
@ -9,10 +9,6 @@ main = do
|
||||||
putStrLn $ "day7a: " ++ (show $ solveA input)
|
putStrLn $ "day7a: " ++ (show $ solveA input)
|
||||||
putStrLn $ "day7b: " ++ (show $ solveB input)
|
putStrLn $ "day7b: " ++ (show $ solveB input)
|
||||||
|
|
||||||
repCom :: String -> String
|
|
||||||
repCom = map f
|
|
||||||
where f c = if c == ',' then ' ' else c
|
|
||||||
|
|
||||||
solveA :: [Int] -> Int
|
solveA :: [Int] -> Int
|
||||||
solveA is = minimum $ map f us
|
solveA is = minimum $ map f us
|
||||||
where
|
where
|
||||||
|
@ -32,3 +28,8 @@ absdiff x y = abs (x - y)
|
||||||
|
|
||||||
expdiff :: Int -> Int -> Int
|
expdiff :: Int -> Int -> Int
|
||||||
expdiff x y = sum $ take (absdiff x y) [1..]
|
expdiff x y = sum $ take (absdiff x y) [1..]
|
||||||
|
|
||||||
|
repCom :: String -> String
|
||||||
|
repCom = map f
|
||||||
|
where f c = if c == ',' then ' ' else c
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue