diff options
| author | Andrey Listopadov <andreyorst@gmail.com> | 2022-07-15 21:24:53 +0300 |
|---|---|---|
| committer | Andrey Listopadov <andreyorst@gmail.com> | 2022-07-15 21:24:53 +0300 |
| commit | 58f91092e2831421aa88be36e9dfa6dd153fd212 (patch) | |
| tree | b57eb0beaedaa7b552790a0feaf73691c49a6e70 | |
| parent | 9c4948b86e0714cf910ccc649e923b83c7ebd938 (diff) | |
fix some names
| -rw-r--r-- | init-macros.fnl | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/init-macros.fnl b/init-macros.fnl index a435bfa..7cbf200 100644 --- a/init-macros.fnl +++ b/init-macros.fnl @@ -1230,7 +1230,7 @@ body." (walk `(do ,(macroexpand body)) true)) -(fn loop [args ...] +(fn loop [binding-vec ...] "Recursive loop macro. Similar to `let`, but binds a special `recur` call that will reassign @@ -1265,9 +1265,9 @@ number of elements in the passed in table. (In this case, 5)" gensyms [] bindings []] (assert-tail recur ...) - (each [i v (ipairs args)] + (each [i v (ipairs binding-vec)] (when (= 0 (% i 2)) - (let [key (. args (- i 1)) + (let [key (. binding-vec (- i 1)) gs (gensym i)] (assert-compile (not (list? key)) "loop macro doesn't support multiple-value destructuring" key) ;; In order to only evaluate expressions once and support sequential @@ -1278,11 +1278,11 @@ number of elements in the passed in table. (In this case, 5)" ;; y (+ x 1)] ;; ...) ;; - ;; (let [sym1# (foo) - ;; [x & xs] sym1# - ;; sym2# (+ x 1) - ;; y sym2] - ;; ((fn recur [[x & xs] y] ...) sym1# sym2#) + ;; (let [_1_ (foo) + ;; [x & xs] _1_ + ;; _2_ (+ x 1) + ;; y _2_] + ;; ((fn recur [[x & xs] y] ...) _1_ _2_) ;; ``` ;; ;; This ensures that `foo` is called only once, its result is cached in a @@ -1304,9 +1304,9 @@ number of elements in the passed in table. (In this case, 5)" ;; Because it would be transformed to: ;; ;; ``` fennel - ;; (let [sym1# (foo) - ;; (x y) sym1#] - ;; ((fn recur [(x y)] ...) sym1#) + ;; (let [_1_ (foo) + ;; (x y) _1_] + ;; ((fn recur [(x y)] ...) _1_) ;; ``` ;; ;; `x` is correctly set, but `y` is completely lost. Therefore, this |