On Fri, May 15, 2009 at 7:25 AM, Jeremy Henty <onepoint / starurchin.org> wrote: > On 2009-05-14, Jeff Moore <jcmoore / pressenter.com> wrote: > >> 1.9.1 adds ¨Βξυνεςαβμε£ςεδυγε ασ σωξοξω¨χθιγθ ναλε ¨Βοςσεξστο >> me) and still retains inject > > Is one of #reduce or #inject deprecated in 1.9.1? Don't think so. Actually IMHO which makes more sense is situational. To me reduce makes sense when the optional initial argument is not used, and inject makes more sense when it is: collection.reduce {|memo, element| ...} vs collection.inject(initial_value) {|memo, element| ...} Several of the Enumerable method names were pretty obviously inspired by the Smalltalk collection hierarcy, select, detect, reject, and inject among them. The Smalltalk method is inject:info: which makes the meaning of inject a bit clearer, in Smalltalk you would write the second example as: collection inject: initialValue into: [memo, element| ...] You are injecting the initialValue into the sequence given to the block. And there are other instances of long-standing aliases like find for detect. Personally I think it's good to have such synonyms, they make it easier to be express subtleties just as they do for authors in natural languages. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale