For summing an array, just use reduce(:+)