The OpenD Programming Language

sum

Sums elements of r, which must be a finite iterable.

A seed may be passed to sum. Not only will this seed be used as an initial value, but its type will be used if it is not specified.

Note that these specialized summing algorithms execute more primitive operations than vanilla summation. Therefore, if in certain cases maximum speed is required at expense of precision, one can use Summation.fast.

  1. template sum(F, Summation summation = Summation.appropriate)
    template sum (
    F
    Summation summation = Summation.appropriate
    ) if (
    isMutable!F
    ) {}
  2. template sum(Summation summation = Summation.appropriate)
  3. template sum(F, string summation)
  4. template sum(string summation)

Members

Functions

sum
F sum(F[] r)

Templates

sum
template sum(Range)
sum
template sum(Range)

Return Value

The sum of all the elements in the range r.

Meta