Computes the series of numbers given an array of numbers.
This method runs in linear time, or O(n), where n
is equal to the length of the summands array.
If there are zero summands, it will return the empty
sum (also known as the nullary sum and vacuous sum),
which is equal to 0 per the additive identity.
In mathematics, it is formally written using the Greek
Capital Sigma (Σ) notation.
Parameters
summands: number[]
multiple terms in a summation
lambda: ((n) => number) = ...
a single-parameter function for mutating each number
Computes the series of numbers given an array of numbers.
O(n)
, wheren
is equal to the length of thesummands
array.