Sum

library operator
ID: 23298eba-0aa0-440d-a78e-83aecd2f5261
Emits the sum of a stream of numbers.

Behavior

Test data showing the behavior of Sum

Integers

It emits the sum of all integers.

Input Output
[1,2,-3,4] 4
[12,9,4] 25
Empty

It emits 0 for empty streams.

Input Output
[] 0
Floats

It emits the sum of all floating point numbers.

Input Output
[1.5,-3.5,2.5] 0.5

Implementation

The implementation of Sum makes use of the following 2 operators.

1
Add
Adds two numbers A and B and emits their sum.
1
Reduces the items of a stream pairwise using a reducer delegate.

Used in

The Sum operator is used by 1 operators.

Emits the average of a stream of numbers.