Prelude API
    Preparing search index...

    Function reduce

    • Creates a reducer function that applies a specified reduction function to an iterable.

      Type Parameters

      • T

        Element type

      • U

        Result type

      Parameters

      • reduction: (result: U, value: T, index: number) => U

        Function that combines the accumulated result with each element

      • initial: U

        Initial value for the reduction

      Returns (values: Iterable<T>) => U

      A function that reduces an iterable to a single value

      G.pipe(
      G.range(1, 5),
      G.reduce((sum, n) => sum + n, 0)
      ) // 15