iter-fns - v0.13.0
    Preparing search index...

    Function scan

    • Folds over each element of the iterable with a reducer function, returning the result of each step of the fold.

      The resulting iterable cannot be reversed, as it would require materialization of the entire input iterable to compute the last value.

      Type Parameters

      • T

        type of the item

      • U

      Parameters

      • iterable: SizedIterable<T>

        the iterable

      • f: (z: U, x: T, i: number) => U

        the step function, which takes the accumulator and item

      • z: U

        the starting accumulator

      Returns SizedIterable<U>

    • Folds over each element of the iterable with a reducer function, returning the result of each step of the fold.

      The resulting iterable cannot be reversed, as it would require materialization of the entire input iterable to compute the last value.

      Type Parameters

      • T

        type of the item

      • U

      Parameters

      • iterable: Iterable<T>

        the iterable

      • f: (z: U, x: T, i: number) => U

        the step function, which takes the accumulator and item

      • z: U

        the starting accumulator

      Returns Iterable<U>