On Tue, Mar 10, 2009 at 2:45 PM, Howard Lewis Ship <hls...@gmail.com> wrote: > > (defmacro example > [& code] > `(let [rcode# ~(reverse code) > fn# (to-fn rcode#)] > (run-example fn#)))
Thanks for the complete example, it really helps. Macroexpand might help you see at least one of the problems: (clojure.core/let [rcode__614__auto__ ((printf "EXAMPLE2\n") (printf "EXAMPLE1\n")) fn__615__auto__ (user/to-fn rcode__614__auto__)] (user/run-example fn__615__auto__)) Since (printf ...) returns nil, it looks like you'll be trying to bind rcode# to the value of (nil nil), that is 'nil' called with a single argument of 'nil'. It actually errors out before it gets that far, but anyway... Try completing as much of your manipulation as is possible outside the syntax-quote: (defmacro example [& code] (let [rcode (reverse code)] `(let [func# (to-fn ~rcode)] (run-example func#)))) Also, try to avoid using builtin names like 'fn' for your own locals. It only leads to more pain in the long run. --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---