Home Manual Reference Source

Function

Static Public Summary
public

* roundRobin(iterables: Iterable[]): IterableIterator

Yields the first item of the first input iterable, then the first item of the second input iterable, etc., until the last input iterable.

Static Public

public * roundRobin(iterables: Iterable[]): IterableIterator source

Yields the first item of the first input iterable, then the first item of the second input iterable, etc., until the last input iterable. Then start again with the second item of the first input iterable, etc. If one of the input iterable is exhausted, it is removed from the list of input iterables and the algorithm continues until all input iterables have been exhausted.

Params:

NameTypeAttributeDescription
iterables Iterable[]

The input iterables.

Return:

IterableIterator

Example:

// returns ['A','D','E','B','F','C]
list( roundrobin(['ABC', 'D', 'EF']) )