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

    Function foldR

    • Folds the elements of list from right.

      Applying foldR to infinite structures usually doesn't terminate. But it may still terminate under one of the following conditions:

      • the folding function is short-circuiting,
      • the folding function is lazy on its second argument.

      Type Parameters

      • T
      • U

      Parameters

      • f: (a: T) => (b: U) => U

        The fold operation.

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

      The folded value.

      Examples

      expect(
      foldR((x: string) => (y: string) => x + y)("")(fromString("hoge")),
      ).toStrictEqual(
      "hoge",
      );
      expect(
      foldR((x: string) => (y: string) => y + x)("")(fromString("")),
      ).toStrictEqual(
      "",
      );