aboutsummaryrefslogtreecommitdiffstats
path: root/AoC2022/aocclj/src
diff options
context:
space:
mode:
Diffstat (limited to 'AoC2022/aocclj/src')
-rw-r--r--AoC2022/aocclj/src/aocclj/day01.clj7
1 files changed, 3 insertions, 4 deletions
diff --git a/AoC2022/aocclj/src/aocclj/day01.clj b/AoC2022/aocclj/src/aocclj/day01.clj
index 8fca2e6..df6d101 100644
--- a/AoC2022/aocclj/src/aocclj/day01.clj
+++ b/AoC2022/aocclj/src/aocclj/day01.clj
@@ -2,17 +2,16 @@
(:require [clojure.string :as str]))
(defn preprocess [input]
- (transduce
+ (sequence
(comp
(map parse-long)
(partition-by nil?)
(take-nth 2)
(map (partial reduce +)))
- conj
input))
(defn part1 [input]
- (apply max (preprocess input)))
+ (reduce max (preprocess input)))
(defn part2 [input]
- (->> input preprocess sort (take 3) (apply +)))
+ (->> input preprocess (sort >) (take 3) (reduce +)))