On 2 July 2010 15:50, Meikel Brandmeyer <m...@kotka.de> wrote: > Then there are examples like this one: > (reduce '* '(1 2 3)) > > Someone who is new to Clojure and tries to understand reduce... Does > he understand why the result is 3? A result which relies on a not very > well-known fact, that you can actually call symbols like keywords for > map lookup with up to two arguments. (I bet there quite a few of > "seasoned" clojurians who didn't know that) I - if I was a newbie to > the language - would mainly think: wtf?
Even with your explanation, I'm baffled... I can get to user=> ('* ('* 1 2) 3) 3 Ah. This means look '* up in ('* 1 2) and use 3 as the default if you don't find it. And you don't (for all sorts of odd reasons - why doesn't this raise a "what are you doing, it's not even a map you're looking up in" exception? :-)), so the result is the default, 3. Uh, yeah. That example is actually harmful - as it confused me about what does and doesn't need quoting - something I would probably have got right instinctively until I read this :-( Paul. -- 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