@mikuroxina/mini-fn
    Preparing search index...

    Function scanL

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

      Type Parameters

      • T
      • U

      Parameters

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

        The scanner for the adjacent elements.

      Returns (init: U) => (src: List.List<T>) => List.List<U>

      The scanned list.

      Examples

      const aList = fromArray([1, 2, 2, 4, 4, 3]);
      const partialSum = scanL((a: number) => (b: number) => a + b)(0)(aList);
      expect(toArray(partialSum)).toStrictEqual([0, 1, 3, 5, 9, 13, 16]);