Skip to content

Commit b2f05ba

Browse files
committed
chore: some cleanup
1 parent 525ac92 commit b2f05ba

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/uclj/core.clj

+9-13
Original file line numberDiff line numberDiff line change
@@ -475,27 +475,23 @@
475475
(let [args (for [a args] (evalme a &b))]
476476
(clojure.lang.Reflector/invokeConstructor clz (into-array Object args)))))))
477477

478-
(def ^:private node-symbols (for [i (range)] (symbol (str 'node- i))))
479-
(def ^:private index-symbols (for [i (range)] (symbol (str 'index i))))
480-
481478
(defmethod seq->eval-node 'recur seq-eval-recur [iden->idx recur-indices [_ & values]]
482479
(when-not recur-indices
483480
(throw (new UnsupportedOperationException "Can only recur from tail position")))
484481
(when-not (= (count recur-indices) (count values))
485482
(throw (new IllegalArgumentException (str "Mismatched argument count to recur, expected: " (count recur-indices) " args, got: " (count values)))))
486-
(template
483+
(template [node-symbols (for [i (range)] (symbol (str 'node- i)))
484+
index-symbols (for [i (range)] (symbol (str 'index i)))]
487485
(case (count ~'recur-indices)
488486
~@(mapcat seq
489-
(for [i (range 20)
490-
:let [node-symbols (take i node-symbols)
491-
index-symbols (take i index-symbols)]]
487+
(for [i (range max-loop-bindings)]
492488
[i
493-
`(let [[~@node-symbols] (map (partial ->eval-node ~'iden->idx nil) ~'values)
494-
[~@index-symbols] ~'recur-indices]
495-
(gen-eval-node
496-
(let [~@(interleave node-symbols (for [n node-symbols] (list 'evalme n '&b)))]
497-
~@(map (partial list 'aset '&b) index-symbols node-symbols)
498-
::recur)))])))))
489+
`(let [[~@(take i node-symbols)] (map (partial ->eval-node ~'iden->idx nil) ~'values)
490+
[~@(take i index-symbols)] ~'recur-indices]
491+
(gen-eval-node
492+
(let [~@(interleave (take i node-symbols) (for [n node-symbols] (list 'evalme n '&b)))]
493+
~@(map (partial list 'aset '&b) (take i index-symbols) (take i node-symbols))
494+
::recur)))])))))
499495

500496
(defmethod seq->eval-node 'throw [&a _ [_ e :as form]]
501497
(assert (= 2 (count form)))

0 commit comments

Comments
 (0)