From b9943d71389c75317c6af442b03f2b1f1f009d48 Mon Sep 17 00:00:00 2001 From: Adam Jeniski Date: Thu, 5 Dec 2024 10:49:44 -0500 Subject: [PATCH] format --- 2024/src/day05.clj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/2024/src/day05.clj b/2024/src/day05.clj index 156b790..f2cf2cc 100644 --- a/2024/src/day05.clj +++ b/2024/src/day05.clj @@ -19,20 +19,20 @@ (defn ordered? [coll] (reduce (fn [acc el] - (if - (some acc (orderings el)) (reduced false) - (conj acc el))) + (if (some acc (orderings el)) + (reduced false) + (conj acc el))) #{} coll)) (defn order [coll] - (reduce (fn [acc p] - (if-let [idxs (->> (orderings p) + (reduce (fn [acc el] + (if-let [idxs (->> (orderings el) (filter #(contains? (set acc) %)) (map #(.indexOf acc %)) (filter #(not= % -1)) not-empty)] - (c/insert-vec acc (apply min idxs) p) - (conj acc p))) + (c/insert-vec acc (apply min idxs) el) + (conj acc el))) [] coll)) ;; part 1