Well, if we're all just going to post our own ideas...


irb(main):002:0* a = [1,2,3,4]
=> [1, 2, 3, 4]
irb(main):004:0> def a.mean
irb(main):005:1>   reduce(&:+) / length
irb(main):006:1> end
=> nil
irb(main):007:0> a.mean
=> 2

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