Merges an array of arrays by adding the elements together.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|# Takes an array of totals_tuples and combines them into a single tuple.|
|tuples.inject() do |xs, ys||
|l = [xs.length, ys.length].max|
|zs = |
|l.times.each do |i||
|zs[i] = (xs[i] || 0) + (ys[i] || 0)|