Skip to main content
Module

x/iterators/accumulate.ts>accumulate

Iterators and related functions for Deno. Similar to Python's itertools module. Unlicensed, do what you want.
Latest
function accumulate
import { accumulate } from "https://deno.land/x/iterators@v0.2.0/accumulate.ts";

Yield accumulated values (similar to Array.reduce, but with intermediate values).

Parameters

iterable: Iterable2<T>
fn: (previous: T, current: T) => T

Returns

Generator<T>

Yield accumulated values (similar to Array.reduce, but with intermediate values).

Parameters

iterable: Iterable2<T>
fn: (previous: U, current: T) => U
initial: U

Returns

Generator<U>