On Oct 17, 10:32 am, Timothy Pratley <timothyprat...@gmail.com> wrote:
> > But name is multiply evaluated. This might be preferable:
>
> Hi John,
>
> Could you explain this a bit more for me? I can understand if the
> condition is duplicated that is unnecessary calculation but don't
> appreciate the issue with the binding name... both versions of the
> macro seem to expand to identical code:
> user=> (macroexpand-1 '(while-let [a nil] (foo)))
> (clojure.core/loop [] (clojure.core/let [a nil] (clojure.core/when a
> (foo) (recur))))
> So my naive view was they would have identical behaviour/performance.
> I've heard this come up before but never understood or been able to
> find any reference about this 'issue'.

I don't think the multiple evaluation matters in this case, since it's
the name parameter, which will in all sane cases be a simple symbol.
gensyms are needed when multiple evaluation could cause side-effects
or an expensive function to be computed multiple times, which is not
the case here.

--~--~---------~--~----~------------~-------~--~----~
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