data = [1, 2, 3, 4]
sum = data.inject { |a, b| a + b } #=> 10
sum/data.size.to_f #=> 2.5