Usually, I think, people write sum with inject:
[1,2,3].inject { |s,i| s + i }
Which is presumably why sum doesn't exist. [1,2,3].inject { |s,i| s + i }
Which is presumably why sum doesn't exist.[1,2,3].inject(:+)