The fold operation.
The folded value.
import { foldR, fromString } from "./list.ts";
import { assertEquals } from "../deps.ts";
assertEquals(
foldR((x: string) => (y: string) => x + y)("")(fromString("hoge")),
"hoge",
);
assertEquals(
foldR((x: string) => (y: string) => y + x)("")(fromString("")),
"",
);
Generated using TypeDoc
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: