Hi Dan,
And, if I understand correctly, what was really happening with the macro
> bar was that in ('+ 2 'u), '+ was looking itself up in 2, not finding
> itself, and so returning the default value 'u. This was the expansion of
> the macro, and so at run time, it was bound to 10.
>
>
exactly, indeed one would expect that the list:
('+ 2 'u)
would throw an exception, since the first element does not evaluate to a
macro/function
however, Clojure allows the use of symbols (in this case, '+) as functions
that lookup themselves into the collection that follows
this special syntax does not apply to numbers:
(1 2 'u)
;=> ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn
user/eval7633 (form-init2468783434806143559.clj:1)
cheers,
Gianluca
--
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.