day7: dangling debug print

This commit is contained in:
Gattix 2021-12-16 21:58:39 +01:00
parent b651b74de2
commit 44e641dbd6

@ -9,7 +9,6 @@ main = do
let middle2 = (sum crabs) `div` genericLength crabs let middle2 = (sum crabs) `div` genericLength crabs
print $ fuel middle1 id crabs print $ fuel middle1 id crabs
print $ fuel middle2 (\x->last $ take (x+1) $ scanl1 (+) [0..]) crabs print $ fuel middle2 (\x->last $ take (x+1) $ scanl1 (+) [0..]) crabs
print middle2
fuel :: Int -> (Int -> Int) -> [Int] -> Int fuel :: Int -> (Int -> Int) -> [Int] -> Int
fuel middle f = sum . map (f . abs . subtract middle) fuel middle f = sum . map (f . abs . subtract middle)