Created
December 2, 2019 00:32
-
-
Save tranzystorekk/314bd14671060d2cc324133d9d31aa3e to your computer and use it in GitHub Desktop.
AoC 2019 day1 part2 Haskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fuelReq :: Int -> Int | |
fuelReq m = div m 3 - 2 | |
fuelChain :: Int -> [Int] | |
fuelChain m = takeWhile (> 0) (iterate fuelReq m) | |
totalFuel = sum $ map (sum . fuelChain) [1, 2, 3, 4, 5] -- <- module masses here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment