From: John Johnson Date: 2006-04-20T08:06:39+09:00 Subject: Re: Symbol#to_proc is just so beautiful On 19-Apr-2006, at 15:03, Florian Gro� wrote: >> When is this ever getting into Ruby Core? >> [1, 2, 3].all? &:positive? => true >> [-1, 2, 3].all? &:positive? => false >> It's just so damn beautiful! > > If you use this definition instead: > > class Symbol > def to_proc() > lambda { |obj, *args| obj.send(self, *args) } > end > end > > You can also do this: > > (1 .. 5).inject(&:+) # => 15 > (1 .. 5).inject(&:*) # => 120 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 (@#$%). Regards, JJ --- Help everyone. If you can't do that, then at least be nice.