• Scans the list from left. It is useful to make the partial sum list.

    Type Parameters

    • T

    • U

    Parameters

    • f: ((u) => ((t) => U))

      The scanner for the adjacent elements.

        • (u): ((t) => U)
        • Parameters

          • u: U

          Returns ((t) => U)

            • (t): U
            • Parameters

              • t: T

              Returns U

    Returns ((init) => ((src) => List<U>))

    The scanned list.

    Examples

    import { fromArray, scanL, toArray } from "./list.ts";
    import { assertEquals } from "../deps.ts";

    const aList = fromArray([1, 2, 2, 4, 4, 3]);
    const partialSum = scanL((a: number) => (b: number) => a + b)(0)(aList);
    assertEquals(toArray(partialSum), [0, 1, 3, 5, 9, 13, 16]);
      • (init): ((src) => List<U>)
      • Parameters

        • init: U

        Returns ((src) => List<U>)

Generated using TypeDoc