Prelude API
    Preparing search index...

    Function reduce1

    • Creates a reducer function that uses the first element of the iterable as the initial value. Similar to reduce but doesn't require an explicit initial value.

      Type Parameters

      • T

        Element type

      Parameters

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

        Function that combines the accumulated result with each element and its index in the input

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

      A function that reduces an iterable using the first element as initial value

      If the input iterable is empty

      G.pipe(
      G.range(1, 5),
      G.reduce1((acc, val) => acc + val)
      ) // 15