xaun-l
11/21/2017 - 3:52 PM

Aggregate Vectors

# Aggregates a Vector of Floats:
# -- input:  [200.0, 200.0, 600.0]
# -- output: [200.0, 400.0, 1000.0]
def aggregate(vector_f)
  aggregated_total = 0.0
  aggregated_array = vector_f.map do |value_f|
    aggregated_total += value_f
  end

  Vector.elements(aggregated_array)
end