From: Mike Gold Date: 2009-01-12T10:02:13+09:00 Subject: Re: functional programming Joel VanderWerf wrote: > Mike Gold wrote: >> data = [[1,2,3], [4,5,6,7]] >> On this example alone, I think my characterization of "quite profound" >> is justified. > > Why isn't this the ruby candidate for comparison: > > mean = lambda { |ary| > (ary.inject { |acc, x| acc + x })/ary.size.to_f > } > data.map(&mean) # => [2.0, 5.5] Sure, you can solve a different problem than the one I gave. But the original problem remains. We cannot, in general, modify 'mean'. Do you propose to change every method in the ruby standard library to take just one argument--an array? That would work. Sounds like Lisp. -- Posted via http://www.ruby-forum.com/.