From db1a89199b1e4422e78025912cebd4a34f1b02bb Mon Sep 17 00:00:00 2001 From: ajet Date: Mon, 22 Dec 2025 18:06:10 -0500 Subject: [PATCH] golf --- 2025/src/day10.clj | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/2025/src/day10.clj b/2025/src/day10.clj index f827e6a..01e56e2 100644 --- a/2025/src/day10.clj +++ b/2025/src/day10.clj @@ -53,19 +53,16 @@ range (map #(.mkIntConst ctx (str "j" %))))] (add-expressions opt (for [idx (range (count joltages))] - (let [jn (nth js idx) - summation-args (->> buttons - (map set) - (map-indexed vector) - (filter #(contains? (second %) idx)) - (map first) - (map #(nth bs %)) - (into-array Expr) - (.mkAdd ctx))] - (.mkEq ctx jn summation-args)))) + (.mkEq ctx (nth js idx) (->> buttons + (map set) + (map-indexed vector) + (filter #(contains? (second %) idx)) + (map first) + (map #(nth bs %)) + (into-array Expr) + (.mkAdd ctx))))) (add-expressions opt (for [[idx joltage] (map-indexed vector joltages)] - (let [jn (nth js idx)] - (.mkEq ctx jn (.mkInt ctx (long joltage)))))) + (.mkEq ctx (nth js idx) (.mkInt ctx (long joltage))))) (add-expressions opt (for [b bs] (.mkGe ctx b (.mkInt ctx (long 0))))) (let [^Optimize$Handle mx (.MkMinimize opt (.mkAdd ctx (into-array Expr bs)))]