• Creates an infinite list with mutating by succ.

    Type Parameters

    • T

    Parameters

    • succ: ((t) => T)

      The successor generator.

        • (t): T
        • Parameters

          • t: T

          Returns T

    Returns ((init) => List<T>)

    The infinite list with applying init to succ.

    Examples

    import { successors, toIterator } from "./list.ts";
    import { assertEquals } from "../deps.ts";

    const iter = toIterator(successors((str: string) => str + "a")(""));
    assertEquals(iter.next(), { value: "", done: false });
    assertEquals(iter.next(), { value: "a", done: false });
    assertEquals(iter.next(), { value: "aa", done: false });
    assertEquals(iter.next(), { value: "aaa", done: false });
    assertEquals(iter.next(), { value: "aaaa", done: false });
      • (init): List<T>
      • Parameters

        • init: T

        Returns List<T>

Generated using TypeDoc