From 57e563bf8f4fae7364118619318b338f16792473 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sun, 5 Feb 2023 21:59:47 +0100 Subject: working with more stuff --- AoC2022/aocclj/src/aocclj/day01.clj | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'AoC2022/aocclj/src') 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 +))) -- cgit v1.2.3