Home Manual Reference Source

Function

Static Public Summary
public

* map(callable: Function, iterable: Iterable): IterableIterator

Applies a given callable to each of the elements of the input iterable.

public

* pick(object: Object, iterable: Iterable): IterableIterator

Yields some of the properties of the input object.

public

* starmap(callable: Function, iterable: Iterable): Iterator

Same as map but allows multiple arguments callable functions.

Static Public

public * map(callable: Function, iterable: Iterable): IterableIterator source

Applies a given callable to each of the elements of the input iterable.

Params:

NameTypeAttributeDescription
callable Function

The callable to use.

iterable Iterable

The input iterable.

Return:

IterableIterator

Example:

// return [ 0 , 1 , 4 , 9 ]
list( map( x => x**2 , range( 4 ) ) ) ;

public * pick(object: Object, iterable: Iterable): IterableIterator source

Yields some of the properties of the input object. The properties to yield are designated by the input iterable.

Params:

NameTypeAttributeDescription
object Object

The input object.

iterable Iterable

The input iterable.

Return:

IterableIterator

Example:

// returns [ 'a' , 'e' , 'c' ]
list( pick( 'abcde' , [ 0 , 4 , 2 ] ) ) ;

public * starmap(callable: Function, iterable: Iterable): Iterator source

Same as map but allows multiple arguments callable functions.

Params:

NameTypeAttributeDescription
callable Function

The callable to use.

iterable Iterable

The input iterable.

Return:

Iterator

Example:

// return [ 0 , 1 , 4 , 9 ]
list( starmap( ( x , y ) => x*y , zip( range( 4 ) , range( 4 ) ) ) ;