Skip to content

Commit 05d2821

Browse files
Merge pull request #521 from brycecovert/master
for bindings can depend on previous ones.
2 parents 1fc28ac + 946b408 commit 05d2821

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

pixie/stdlib.pxi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,14 +2606,14 @@ Expands to calls to `extend-type`."
26062606
`(loop [res# []
26072607
~c (seq ~coll)]
26082608
(if ~c
2609-
(recur (into res#
2610-
~(gen-loop (into coll-bindings
2611-
[binding `(first ~c)])
2612-
(nnext bindings)))
2613-
(next ~c))
2609+
(let [~binding (first ~c)]
2610+
(recur (into res#
2611+
~(gen-loop (into coll-bindings
2612+
[binding `(first ~c)])
2613+
(nnext bindings)))
2614+
(next ~c)))
26142615
res#)))
2615-
`(let ~coll-bindings
2616-
[~@body])))]
2616+
`[~@body]))]
26172617
`(or (seq ~(gen-loop [] bindings)) '())))
26182618

26192619
(defmacro doto

tests/pixie/tests/test-stdlib.pxi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,11 @@
452452
(t/assert= (for [x [1 2 3] y [:a :b :c]] [x y])
453453
[[1 :a] [1 :b] [1 :c]
454454
[2 :a] [2 :b] [2 :c]
455-
[3 :a] [3 :b] [3 :c]]))
455+
[3 :a] [3 :b] [3 :c]])
456+
(t/assert= (for [x [[1 2 3]]
457+
y x]
458+
y)
459+
[1 2 3]))
456460

457461
(t/deftest test-doto
458462
(let [a (atom 0)]

0 commit comments

Comments
 (0)