Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/ahh/src/iter/mod.ts>I.successors

Idiomatic type-safety functions.
Go to Latest
method I.successors
import { I } from "https://deno.land/x/ahh@v0.10.1/src/iter/mod.ts";

Creates an Iterator where each successive item is computed from the preceding one.

Examples

import { I } from "./mod.ts";

const iter = I.successors(0, (i) => i + 1);

console.log(iter.next()); // 0
console.log(iter.next()); // 1
console.log(iter.next()); // 2
console.log(iter.next()); // 3

Parameters

first: Option<T>
f: (_: T) => Option<T>