John Johnson wrote:


> IIIEEEeee, it's Perl, it's Perl!  :-)
> 
> I don't see anything wrong with:
> 
> [1, 2, 3].all? { |n| n > 0 }
> 
> It's a lot more legible than getting into all the Snoopy talk (@#$%).

I agree that it's fine, but:

a) It can be expressed with a shorter code snippet (less line noise), 
therefore making it easy to do method-chaining.

b) I implicitly understand that it is an array of numbers, so the idea 
of "a number" repeats itself three times (you had to write 'n' twice).

a better example might be:
all_people.select { |person| person.retired? }
The subject of this operation is expressed twice more than it ought to 
be.

Therefore,

[1,2,3].all?(:>, 0)
and
all_people.select(:retired?)

is also, IMHO, a good choice.

-- 
Posted via http://www.ruby-forum.com/.