If I could hazard a guess, it has to do with symbol lookup in maps. Try the following:
('foo {'foo 1}) ('foo {'bloo 1} 4) when you do ('foo 1), it can't find foo in 1 (because it isn't there, and 1 isn't even a map), so it returns nil. If you do ('foo 1 2), you've just provided a default value, which it dutifully returns. It's interesting that symbols don't care whether they are passed maps or not----fun fact! On Jan 3, 2:47 pm, Bill Caputo <logos...@gmail.com> wrote: > Hi All, > > So, I've been doing some experimentation in order to better understand > the reader, and I can't figure out why I get the following results for > these four calls: > > => ('foo) ; ((quote foo)) > java.lang.IllegalArgumentException: Wrong number of args (0) passed > to: Symbol (NO_SOURCE_FILE:0) > > => ('foo 1) ; ((quote foo) 1) > nil > > => ('foo 1 2) ; ((quote foo) 1 2) > 2 > > => ('foo 1 2 3) > java.lang.IllegalArgumentException: Wrong number of args (3) passed > to: Symbol (NO_SOURCE_FILE:0) > > What I expected is that either foo would be invoked (and so I'd see an > error because it didn't exist) *or* I'd get a list ala (foo 1 2) > - further, I can't understand why I get "nil" for an arity of 1 but > "2" for an arity of two). > > Anyone have an explanation? I'm off to find the impl for "Symbol" and > see if I can figure out how it is being invoked here... > > Thanks, > Bill -- 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