On 2010 Apr 8, at 11:48 PM, Per Vognsen wrote:
The body of fn is still compiled in an expression context. When the
compiler sees (fn [...] ...), it will introduce the bindings into the
local environment and recursively compile the body in that
environment. Note that I said compile rather than evaluate. If you
make a phase distinction between compile time and run time, all this
should be easier to understand.

Yes, I knew there was another "time" involved, but not now to get access to that in my own code. :)


If you're still confused, check out Compiler.java. The code is very
simple and everything is right there.

I've come to clojure with Lisp, C, C++, Python, Forth... roots.
Java, not so much. But I'll look. Thank you for the explanations.


Macro expansion happens (and has to happen) before everything I
described above. Your macro will see symbols, not vars.

Yes, I understood that part.

If the macro splices some of the symbols into places that after all macro expansion
are in expression context, they will be resolved into vars. You
generally don't have to invoke the resolution machinery yourself as
long as you do that.

Understood. The macro is going to store the unevaluated form (probably into a list, maybe into a map), and then other code is going to walk and mutate it before it (eventually) gets evaluated. I'd like to check the form before any further processing happens on it, so it sounds like what I need is a tree walker that just checks resolve's return value as a side effect.

Thanks,
        -Doug

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to