Hyperlinkv0.8.0-beta.28

BigInt

BigInt.ReducerMultiplyconsteffect/BigInt.ts:992
Reducer.Reducer<bigint>

Reducer for combining bigints using multiplication.

When to use

Use to multiply many bigint values through APIs that consume a Reducer.

Details

The initial value is 1n, so combineAll([]) returns 1n.

Source effect/BigInt.ts:9928 lines
export const ReducerMultiply: Reducer.Reducer<bigint> = Reducer.make((a, b) => a * b, bigint1, (collection) => {
  let acc = bigint1
  for (const n of collection) {
    if (n === bigint0) return bigint0
    acc *= n
  }
  return acc
})