Skip to content

Commit 8d4ea9d

Browse files
committed
fix another long-standing gotcha: destructuring in whilet
1 parent 3c016ec commit 8d4ea9d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

arc.arc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,6 @@
550550
(= (s2 i) (seq (+ start i))))
551551
s2)
552552
(firstn (- end start) (nthcdr start seq)))))
553-
554-
(mac whilet (var test . body)
555-
(w/uniq (gf gp)
556-
`((rfn ,gf (,gp)
557-
(let ,var ,gp
558-
(when ,var ,@body (,gf ,test))))
559-
,test)))
560553

561554
(def last (xs)
562555
(if (cdr xs)
@@ -746,6 +739,14 @@
746739
(mac awhen (expr . body)
747740
`(let it ,expr (if it (do ,@body))))
748741

742+
(mac whilet (var test . body)
743+
(w/uniq (gf gp)
744+
`((rfn ,gf (,gp)
745+
(whenlet ,var ,gp
746+
,@body
747+
(,gf ,test)))
748+
,test)))
749+
749750
(mac aand args
750751
(if (no args)
751752
't

0 commit comments

Comments
 (0)