On Fri, Oct 23, 2009 at 3:16 PM, Howard Lewis Ship <[email protected]> wrote: > > I like to try and keep my level of nesting under control, and this > often involves hiding or re-structuring the let macro. The for macro > can implicitly assemble a let macro for you, but with a limitation > that the :let clause can't be first: > > 1:5 user=> (for [:let [z [:foo :bar]] x z] (name x)) > java.lang.IllegalStateException: Can't pop empty vector (repl-1:5) > 1:6 user=> (for [x [:foo :bar] :let [z (name x)]] z) > ("foo" "bar") > 1:7 user=> > > Is this limitation intentional? Could the error message be improved?
It's not an intentional limitation. One hint of this is that :let, :while, and :when all work perfectly fine at the beginning of a doseq. Improving the error message would be easy. On the other hand, a patch to support them at the beginning of a 'for' should be possible. I think it might be worthwhile, particulary for macros that generate 'for' forms. The machinery inside a 'for' expansion is hard to do yourself. Rich, would you consider a patch to support this? --Chouser --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
