1 (ns adventofcode2019.day01
2 [:require [adventofcode2019.lib :refer :all]
3 [clojure.string :as str]])
5 (defn get-fuel-req [mass]
6 (reduce + (take-while #(> % 0) (drop 1 (iterate #(- (quot % 3) 2) mass)))))
8 (defn total-fuel-requirement-naive [input]
9 (reduce + (map #(- (quot % 3) 2) input)))
11 (defn total-fuel-requirement [input]
12 (reduce + (map get-fuel-req input)))
15 (let [input (map parse-int (get-list-from-file (input-file)))]
16 (println (total-fuel-requirement-naive input))
17 (println (total-fuel-requirement input))))