reduce
fun <In, Out> reduce(convert: (new: In & Any, Interval) -> Out, combine: (new: In & Any, acc: Out & Any, Interval) -> Out): NullBinaryOperation<In, Out, Out>
Constructs a binary operation for a reduce-style timeline operation.
This pattern uses an input and output type, which in most cases will be equal. The code that invokes this operation will keep track of an "accumulator", which may start uninitialized. If the accumulator is null
, the "convert" function is used to take one input and create the accumulator. If the accumulator is defined, the "combine" function is used to combine it with new inputs until the input is consumed. The output is the final value of the accumulator.
Parameters
convert
Converts an input into the accumulator.
combine
Combines the accumulator with a new input.
See gov.nasa.ammos.aerie.procedural.timeline.ops.ParallelOps.reduceIntoProfile for an example of where it should be used.