(defmacro print_symbol [s] `(quote ~s))

You should consider downloading on lisp by Paul Graham from this page :
http://www.paulgraham.com/onlisptext.html

You'll learn everything you want to know about macros (it's in Common Lisp,
but I think it is understable with just a clojure background, concerning the
concepts)


regards,

-- 
laurent

2009/2/6 CuppoJava <patrickli_2...@hotmail.com>

>
> Hi,
> I'm trying to write a macro that outputs a symbol without attempting
> to resolve it and would appreciate some pointers.
>
> eg. I wrote a function that accepts a symbol as an argument
> (defn print_symbol [a]
>  (println a))
>
> which can be called like this: (print_symbol 'mysymbol)
>
> But I want to write a macro that allows me to write this:
> (print_symbol mysymbol)
>
> So the macro should convert mysymbol -> 'mysymbol, without resolving
> the symbol.
>
> I'm wondering if that is possible.
> Thanks very much for your help
>  -Patrick
> >
>

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

Reply via email to