Minimum number

library operator
ID: 6422aa8f-b4f0-4acc-9931-820431e0c462
Finds smallest number in a stream of numbers.

Behavior

Test data showing the behavior of Minimum number

Integers

It emits the smallest integer.

Input Output
[4,1,3,2] 1
[12,9,4,1,76,4] 1
[12,9,4,26,7,35,4] 4
Empty

It emits null for empty streams.

Input Output
[] null
Floats

It emits the largest float.

Input Output
[3.5,1.5,2.5] 1.5
[-1.5,8.2,-22.25] -22.25

Implementation

The implementation of Minimum number makes use of the following 3 operators.

1
Emits true only if number A is less than number B.
1
Takes two items and emits one of them, using a chooser delegate as decider.
1
Reduces the items of a stream pairwise using a reducer delegate.