On Jun 17, 12:44 am, Daniel Lyons <[email protected]> wrote: > On Jun 16, 2009, at 10:34 PM, Wrexsoul wrote: > > > > > > > > > I'm shocked that this is missing from clojure.core: > > > (defn accum [f init coll] > > (loop [x init c coll] > > (if (empty? c) > > x > > (recur (f x (first c)) (rest c))))) > > > user=> (accum + 0 [1 2 3]) > > 6 > > user=> (accum + 0 [1 2 3 4 5]) > > 15 > > > This is one of the most basic, useful functions in functional > > programming. :) > > Indeed! It's called reduce: > > http://clojure.org/api#toc476 > > I'm shocked you haven't noticed it in the API documentation. Being > able to read is one of the most basic, useful skills in programming. > Especially if you want to be pompous without being an ass. > Please refrain from communicating this way on this group. If a post annoys you please ignore it. It is much more important that we maintain civility and respectfulness here. Thanks, Rich --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
