Algorithm.map

Creates a new container from an enumerable, having applied a function to all its entries.

Arguments

The

enumerable0
is an enumerable containing source elements.
The
callable
is a function to be applied to each element, with the following stack notation:

( value0 -- value1 )

Return values

enumerable1
is the resulting enumerable.

Complexity

Depends on the source enumerable and the callable.

Example

"sl/algorithm" useFile "sl/linkedList" useFile a: ( 2.0 3.0 5.0 6.0 7.0 ) makeList [sqrt] map; a [print LF print] each
Output:
1.414214 1.732051 2.236068 2.449490 2.645751