fold<R> method

Bloom<R> fold<R>(
  1. R initialValue,
  2. R combine(
    1. R accumulator,
    2. T item
    )
)

Folds the payloads of all members into a single reactive Bloom<R>.

  • initialValue: The initial accumulator value.
  • combine: The folder function combining accumulator and current element payload.

Ensures:

  • Returns a reactive Bloom<R> holding the folded result.

Implementation

Bloom<R> fold<R>(R initialValue, R Function(R accumulator, T item) combine) =>
    computed((via) => via(this).fold(initialValue, (acc, item) => combine(acc, via(item))));