On Sat, Oct 17, 2009 at 2:27 PM, Christophe Grand <christo...@cgrand.net>wrote:

> (defmacro while-let
>  "Makes it easy to continue processing an expression as long as it is true"
>  [binding & forms]
>   `(loop []
>      (when-let ~binding
>        ~...@forms
>        (recur))))
>

This does look like the best implementation so far.

Maybe a general tip for macro design: if you want one or more bindings, see
if you can't make the macro simply stick these into an existing
binding-using form, like let, loop, if-let, etc.

(I cheated: rather than manually working around this bug, I used when-let
> which already does the right thing.)
>

It's not cheating to build on existing, useful library functionality. And
when you can, it's silly not to. I just wish I'd thought of it first.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to