|
475 | 475 | (let [args (for [a args] (evalme a &b))]
|
476 | 476 | (clojure.lang.Reflector/invokeConstructor clz (into-array Object args)))))))
|
477 | 477 |
|
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 |
| - |
481 | 478 | (defmethod seq->eval-node 'recur seq-eval-recur [iden->idx recur-indices [_ & values]]
|
482 | 479 | (when-not recur-indices
|
483 | 480 | (throw (new UnsupportedOperationException "Can only recur from tail position")))
|
484 | 481 | (when-not (= (count recur-indices) (count values))
|
485 | 482 | (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)))] |
487 | 485 | (case (count ~'recur-indices)
|
488 | 486 | ~@(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)] |
492 | 488 | [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)))]))))) |
499 | 495 |
|
500 | 496 | (defmethod seq->eval-node 'throw [&a _ [_ e :as form]]
|
501 | 497 | (assert (= 2 (count form)))
|
|
0 commit comments