From e5476361c9d8c2e5adfcc066fc593badc1b8f1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Sun, 20 Sep 2026 03:15:32 -0600 Subject: [PATCH] --- src/expand.clj | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/expand.clj b/src/expand.clj index b4c3cc6..086f7bd 100644 --- a/src/expand.clj +++ b/src/expand.clj @@ -498,11 +498,18 @@ (let [c (atom {})] (clojure.walk/postwalk (fn [x] - (if (and (symbol? x) (str/starts-with? (name x) "scope__")) - (let [syms (swap! c #(if (contains? % x) - % - (assoc % x (symbol (str "s" (count %))))))] - (get syms x)) + (if (instance? Variable x) + (let [[sym scopes] (destructure-variable x) + syms (swap! + c + #(let [r (set/difference scopes (keys %))] + (into % + (map-indexed + (fn [n a] + [a (symbol (str "s" (+ (dec (count r)) n)))]) + r))))] + #_(->Variable sym (set (map #(get syms %) scopes))) + [sym (set (map #(get syms %) scopes))]) x)) datum)))