Creates a consumer that reduces values from an async iterable to a single result.
Function that takes the accumulated result, the current value, and the index, and returns the new accumulated result
The initial value for the reduction
A consumer function that returns a promise resolving to the final reduced value
Processes each value in the async iterable using the provided reduction function, accumulating a result starting with the initial value.
const sum = await G.pipe( G.ofIterable([1, 2, 3, 4, 5]), G.reduce((acc, value) => acc + value, 0)); // sum === 15 Copy
const sum = await G.pipe( G.ofIterable([1, 2, 3, 4, 5]), G.reduce((acc, value) => acc + value, 0)); // sum === 15
Creates a consumer that reduces values from an async iterable to a single result.