Open glchapman opened 7 months ago
I was macroexpanding some of the test cases to get an idea of what loopr does, when I noticed this:
(loopr [sum 0] [x (int-array [1 2 3]) :via :array] (recur (+ sum x)))
expands into this:
(let* [sum 0 res-7471 (clojure.core/let [x-i-max-7473 (clojure.core/alength (int-array [1 2 3]))] (clojure.core/loop [x-i-7472 (clojure.core/int 0) sum sum] (if (clojure.core/= x-i-7472 x-i-max-7473) sum (clojure.core/let [x (clojure.core/aget (int-array [1 2 3]) x-i-7472)] (recur (clojure.core/unchecked-inc-int x-i-7472) (. clojure.lang.Numbers (add sum x)))))))] (if (clojure.core/instance? dom_top.core.Return res-7471) (.value res-7471) res-7471))
You can see that the int-array form will be evaluated multiple times.
int-array
I was macroexpanding some of the test cases to get an idea of what loopr does, when I noticed this:
expands into this:
You can see that the
int-array
form will be evaluated multiple times.