Skip to content

Commit

Permalink
fix another long-standing gotcha: destructuring in whilet
Browse files Browse the repository at this point in the history
  • Loading branch information
akkartik committed Aug 26, 2011
1 parent 3c016ec commit 8d4ea9d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions arc.arc
Expand Up @@ -550,13 +550,6 @@
(= (s2 i) (seq (+ start i))))
s2)
(firstn (- end start) (nthcdr start seq)))))

(mac whilet (var test . body)
(w/uniq (gf gp)
`((rfn ,gf (,gp)
(let ,var ,gp
(when ,var ,@body (,gf ,test))))
,test)))

(def last (xs)
(if (cdr xs)
Expand Down Expand Up @@ -746,6 +739,14 @@
(mac awhen (expr . body)
`(let it ,expr (if it (do ,@body))))

(mac whilet (var test . body)
(w/uniq (gf gp)
`((rfn ,gf (,gp)
(whenlet ,var ,gp
,@body
(,gf ,test)))
,test)))

(mac aand args
(if (no args)
't
Expand Down

0 comments on commit 8d4ea9d

Please sign in to comment.