On Monday 15 December 2008 17:58, Mark Volkmann wrote: > I'm trying to understand the difference between these. Is it that > macros expanded by macroexpand-1 could result in calls to additional > macros that won't be expanded, but macroexpand will continue > expanding until no macro calls remain? > > It tried: > (macroexpand-1 '(or (< 2 1) (< 3 2) (< 1 2))) > > which output: > (clojure.core/let [or__2940 (< 2 1)] (if or__2940 or__2940 > (clojure.core/or (< 3 2) (< 1 2)))) > > Then I tried: > (macroexpand '(or (< 2 1) (< 3 2) (< 1 2))) > > which output almost the same thing: > (let* [or__2940 (< 2 1)] (if or__2940 or__2940 (clojure.core/or (< 3 > 2) (< 1 2)))) > > What is "let*"? (doc let*) doesn't know about it.
I'm guessing it's something "let-like" that you (and I) don't need to know about... Anyway, you're right about the difference between macroexpand and macroexpand-1, but it's important to understand that the difference is based _only_ on the top symbol of the original form or of any subsequent form yielded by a single application of macro expansion. In other words, if there's a macro embedded within the result of macroexpand-1, it will remain unexpanded by macroexpand. The nature of the transformations between the output of the Clojure reader and the final resulting bytecode for any given form are not trivial (not an insight, of course). There was a thread about this a couple of months ago. I direct you to <http://groups.google.com/group/clojure/msg/28837d55525306d8> for a comprehensive treatment and some additional code you can use to get pervasive macro expansion of forms you might wish to evaluate. Randall Schulz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
