On 01.12.2008, at 15:28, Mark McGranaghan wrote:

> You might find this group post on a "recursive macroexpand" useful:
> http://groups.google.com/group/clojure/browse_thread/thread/ 
> bba604cee3b232d9/28837d55525306d8?lnk=gst&q=recursive 
> +macroexpand#28837d55525306d8

Thanks! Like the original poster, I am surprised how complicated this  
is to do and that there is no built-in function to do it. I suppose  
that the compiler in fact never does a full expansion, but expands  
macro as it works through a form that it is compiling.

I ended up debugging my macro combination by inserting (prn)  
liberally into my macro definitions. I quickly discovered that macros  
are expanded starting from the outermost ones and progressing  
inwards. It doesn't take much thought to understand that it has to  
work that way, but, probably by analogy with function applications, I  
had expected it to work from inside out.

I would in fact like to have a way to define a macro such that it  
expands all macros in its argument forms before applying itself, but  
I guess that amounts to the same code as is shown in the message  
quoted above, and I also guess it would be counter-intuitive to  
experienced Lisp programmers.

Konrad.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to