@Jürgen and Chris

Thank you very much for helping me enlarge my understanding of macros!

I realize that learning the subtleties of a macro implementation is
not easy but well worth the effort.

It is also quite interesting that a macro as it seems takes two
implicit extra arguments. I am curious what these arguments might be
and hope someone can tell us.

Stefan

> Actually, it's not. That's becuase the compiler inserts a couple of
> extra implicit arguments to all calls to macros. So in fact, my-infix,
> at runtime, expects 3 arguments. Check this out:
>
> user=> (defmacro foo [x] x)
> #'user/foo
> user=> (foo 23)
> 23
> user=> (def foo2 (var-get #'foo))
> #'user/foo2
> user=> (foo2 23)
> java.lang.IllegalArgumentException: Wrong number of args (1) passed
> to: user$foo (NO_SOURCE_FILE:0)
> user=> (foo2 23 34 45)
> 45
>
> I hope that makes it clearer. I certainly feel like I understand
> macros a little better after figuring this out.
>
> As for what exactly the two implicit args to macros are - I don't
> know. Someone else will have to explain that.
>
> - Chris

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