What is the meaning of: ('+ '1 '2) On the surface it appears that '2 is simply the last evaluated, but lets try some similar calls: user=> ('+) java.lang.IllegalArgumentException: Wrong number of args passed to: Symbol user=> ('+ '1) nil user=> ('+ '1 '2) 2 user=> ('+ '1 '2 '3) java.lang.IllegalArgumentException: Wrong number of args passed to: Symbol user=> ('1 '2 '3) java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Fn
Non-empty Lists are considered calls to either special forms, macros, or functions. A call has the form (operator operands*). '+ is just (quote +) which returns a Symbol. That Symbol is being treated as a function which can have 1 or 2 arguments. My guess this is actually looking up a symbol in the symbol list??? user=> ('a 2 +) #<core$_PLUS___230 clojure.core$_plus___...@8d0b0f> Regards, Tim. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---