map

Apply a lambda over data in a map< K, V >, list< T >, or set< T >.

Parameters:

No. Type Comments
1 map< K, V >, list< T > or set< T > The object on which the lambda should be applied
2 A lambda that accepts 1 or 2 parameter When 1st parameter to map is a list< T > or set< T >,then the 1st parameter to lambda is one of its elements.
When 1st parameter to map is a map< K, V >, the lambda accepts 2 parameters, the key and value per entry. The return value is to be used as the key of the output map entry.
3 lambda that accepts 2 parameters When 1st parameter to map is a map< K, V >, the lambda accepts 2 parameters, the key and value per entry. The return value is to be used as the value of the output map entry.

Returns:

A map< K, V >, list< T > or set< T > that has has lambda applied per entry of the collection.

Usages:

  • map( v:list<T>, e => result : R ) : list<R>
  • map( v:set<T>, e => result : R ) : set<R> For the input is a map, the 2 lambdas are supplied to produce the key and value per new output entry.
  • map( v:map<K, V>, (k, v) => result : K1, (k, v) => result : V1 ) : map<K1, V1>