From 9ea11f35c9c87ba192c2721b201bfab8bd95795a Mon Sep 17 00:00:00 2001 From: ajet Date: Fri, 12 Dec 2025 12:21:02 -1000 Subject: [PATCH] rename --- 2025/src/day10.clj | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/2025/src/day10.clj b/2025/src/day10.clj index 9e7d134..9a0bee4 100644 --- a/2025/src/day10.clj +++ b/2025/src/day10.clj @@ -50,7 +50,7 @@ (def Int z3/Int) (def Optimize z3/Optimize) (def Sum z3/Sum) -(defn apply-formulas! [opt [f & fs]] +(defn add-formulas! [opt [f & fs]] (when f (! "add" opt f) (recur opt fs))) @@ -67,19 +67,19 @@ count range (map #(Int (str "j" %))))] - (apply-formulas! 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 %)))] - (py= jn (apply Sum summation-args))))) - (apply-formulas! opt (for [[idx joltage] (map-indexed vector joltages)] - (let [jn (nth js idx)] - (py= jn joltage)))) - (apply-formulas! opt (for [b bs] (py>= b 0))) + (add-formulas! 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 %)))] + (py= jn (apply Sum summation-args))))) + (add-formulas! opt (for [[idx joltage] (map-indexed vector joltages)] + (let [jn (nth js idx)] + (py= jn joltage)))) + (add-formulas! opt (for [b bs] (py>= b 0))) (! "minimize" opt (apply Sum bs)) (! "check" opt) (let [model (! "model" opt)]