Skip to main content
Module

x/itertools/more-itertools.ts>heads

🦕 A TypeScript port of Python's itertools and more-itertools for Deno
Latest
function heads
import { heads } from "https://deno.land/x/itertools@v1.1.2/more-itertools.ts";

Yields the heads of all of the given iterables. This is almost like roundrobin(), except that the yielded outputs are grouped in to the "rounds":

>>> [...heads([1, 2, 3], [4], [5, 6, 7, 8])]
[[1, 4, 5], [2, 6], [3, 7], [8]]

This is also different from zipLongest(), since the number of items in each round can decrease over time, rather than being filled with a filler.

Parameters

...iters: Array<Iterable<T>>

Returns

Iterable<Array<T>>