Hi, Mian Pao.
When you call the macro te, a is bound to the *symbol* 'print, not the
*function* print. So, what the ~(a b c) form is doing is calling the
symbol 'print as a function:
('print 1 '(2 3)) => '(2 3)
This is because symbols and keywords implement the function interface, and
the call above is equivalent to
(get 1 'print '(2 3)) => '(2 3) ; Tries to look up 'print in the data
structure 1, fails, uses default value '(2 3).
Hope that helps,
Leif
On Thursday, December 24, 2015 at 8:38:44 AM UTC-5, Mian Pao wrote:
>
> I just write a macro
>
> ```
> (defmacro te
> [a b & c]
> `(print
> ~(a b c)))
> ```
>
> and i run
>
> ```
> (macroexpand '(te print 2 3 4))
> ;=> (clojure.core/print (3 4))
> ```
>
> it get `(clojure.core/print (3 4))` not `(clojure.core/print nil)`
>
> iti is mean `(print 2 '(3 4))` return (3 4)?
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.