Home Manual Reference Source

Function

Static Public Summary
public

* cycle(iterable: Iterable): IterableIterator

Cycles through the input iterable.

public

* ncycle(iterable: Iterable, n: Number): Iterator

Same as cycle but only cycles a limited number of times.

Static Public

public * cycle(iterable: Iterable): IterableIterator source

Cycles through the input iterable.

Params:

NameTypeAttributeDescription
iterable Iterable

The input iterable.

Return:

IterableIterator

Example:

// returns [0,1,0,1,0,1,0]
list(head(cycle(range(2)),7)) ;

public * ncycle(iterable: Iterable, n: Number): Iterator source

Same as cycle but only cycles a limited number of times.

Params:

NameTypeAttributeDescription
iterable Iterable

The input iterable.

n Number

The number of times to cycle through the input iterable.

Return:

Iterator

Example:

// returns [0,1,0,1,0,1,0,1]
list(ncycle(range(2),4)) ;