Thank you for your explanation! I don't think I fully understand your
point. But I'll try. :)

On 11월3일, 오후11시24분, Chouser <[EMAIL PROTECTED]> wrote:
> On Mon, Nov 3, 2008 at 9:13 AM, Chanwoo Yoo <[EMAIL PROTECTED]> wrote:
>
> > Below code is copied from 'On Lisp'. I just changed , to ~. But this
> > code does not work in Clojure.
>
> > (defmacro abbrev [short long]
> >  `(defmacro ~short [& args]
> >     `(~'~long [EMAIL PROTECTED])))
>
> > Is there any important issue what I am overlooking when writing macros
> > in Clojure? Any help appreciated.
>
> (defmacro abbrev [short long]
>  `(defmacro ~short [& args#]
>     `(~'~long [EMAIL PROTECTED])))
>
> Your clue here is the error message:
>
> Can't use qualified name as parameter: user/args
>
> Clojure has a unique combination of features that help increase the
> hygine of macros.  In your original translation, the word "args" was
> resolved into the "user" namespace because it was left bare.  For
> local names (like formal arguments, "let" locals, etc.) you don't want
> that, so you need to use some mechanism to make it clear what you
> mean.  One such mechanism is gensym (in this case I used the trailing
> # which is an auto-gensym).  Another option is ~'foo which would
> explicitly capture "foo" from the context where the macro is expanded.
>
> --Chouser
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to