aboutsummaryrefslogtreecommitdiffstats
path: root/AoC2022/aocclj/src
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2023-02-05 21:59:47 +0100
committerOscar Najera <hi@oscarnajera.com>2023-02-05 22:49:20 +0100
commit57e563bf8f4fae7364118619318b338f16792473 (patch)
treec21701f70f1440fa8078531929e883f4437e9577 /AoC2022/aocclj/src
parent4daf41bd69e01f137be90881ec419b3c045a2ec5 (diff)
downloadscratch-57e563bf8f4fae7364118619318b338f16792473.tar.gz
scratch-57e563bf8f4fae7364118619318b338f16792473.tar.bz2
scratch-57e563bf8f4fae7364118619318b338f16792473.zip
working with more stuff
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 +)))