AdventOfCode/2022/day1.clj

7 lines
359 B
Clojure
Raw Permalink Normal View History

2022-12-01 20:49:20 +10:30
(require '[clojure.string :as str])
2022-12-03 17:22:53 +10:30
(def filename "input/1")
2022-12-01 20:49:20 +10:30
(def elves-rations (map #(map read-string %) (map str/split-lines (str/split (slurp filename) #"\n\n"))))
(def elves-totals (map #(reduce + %) elves-rations))
(def sorted-totals (sort elves-totals))
(println (last sorted-totals)) ; Part 1
(println (reduce + (take-last 3 sorted-totals))) ; Part 2