fold

suspend fun <R> fold(initial: R, operation: suspend (acc: R, result: Output) -> R): ParallelNodeExecutionResult<R>(source)

Folds the result output into a single value and leaves the base context.

Return

The NodeExecutionResult with the folded output and the context from the first result

Parameters

initial

The initial value for the fold operation

operation

The operation to apply to each result

Throws

if the results list is empty