On Sat, Nov 14, 2009 at 6:03 PM, Meikel Brandmeyer <m...@kotka.de> wrote:

> Hi,
>
> Am 14.11.2009 um 20:31 schrieb John Harrop:
>
>
>  For situations like this, I find it handy to discover what reader-macros
>> are expanding to. This works well:
>>
>> user=>(defmacro expand [arg] (println arg))
>> #'user/expand
>> user=>(expand #(@%))
>> (fn* [p1__6536] ((clojure.core/deref p1__6536)))
>>
>
> user=> (macroexpand-1 '#(@%))
> (fn* [p1__13] ((clojure.core/deref p1__13)))


Funny, I get
user=> (macroexpand-1 '#(@%))
(fn* [p1__6540] (@p1__6540))

as apparently the Enclojure REPL turns "(deref foo)" back into "@foo" when
printing it. In fact I fiddled with the macro just because '#(@%) by itself
at my REPL just echoed itself. But this does work:

user=> (prn '#(@%))
(fn* [p1__6544] ((clojure.core/deref p1__6544)))

So does temporarily clicking off pretty-printing at the REPL and just
evaluating '#(@%).

On the other hand, the macro's argument doesn't need to be quoted, so
there's one less awkward-to-type punctuation character. :)

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

Reply via email to