From: Rick DeNatale Date: 2009-03-06T02:50:52+09:00 Subject: Re: Any solutions to Ruby's inconsistencies? --0016361e7e7cd28d8804646285ce Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Thu, Mar 5, 2009 at 11:52 AM, C. Dagnon wrote: > > While I think I can find a use for reject and > inject, select doesn't make much sense to me. I'll have to see if I can > fit that into my mindmap.. Think of it selecting the elements of the enumerable for which the block is 'true'. Another analogy is to an SQL SELECT statement with the block taking the part of the WHERE clause. The *ect methods are evidence of the influence of Smalltalk on Ruby, particularly inject, which is a Smalltalk variant on the more common reduce operation which allows injection of an initial value outside of the receiver into the sequence. Ruby 1.9 adds the alias :reduce to Enumerable#inject. -- 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 --0016361e7e7cd28d8804646285ce--