Loading

LMAP

lists

The LMAP function applies a macro on each element of a LIST. It produces a LIST with the resulting element on top of the stack after each macro invocation.

The macro is called with a stack containing the LIST index on top and the element at that particular index below it.

Since Warp 10 2.4.0, you can override this behaviour with a boolean.

LMAP is available since version 1.0.0.

See also

Signatures

Examples

[ 42 21 11 ] <% DROP 2 * %> //ignore the index, double the result LMAP //do the same thing with FOREACH [] //new list [ 42 21 11 ] <% 2 * +! %> //append value*2 on the list FOREACH
//macro to print "list[i]: value" string <% TOSTRING //convert index in string 'list[' SWAP + //concatenate list[ before the index ']=' + //concatenate ]= SWAP //place value on top of the stack TOSTRING + //convert value in string, concatenate to the string %> 'mymacro' STORE [ 42 21 11 ] $mymacro LMAP
// since Warp 10 2.4.0 [ NEWGTS 'gtsA' RENAME NEWGTS 'gtsB' RENAME ] <% NAME %> F LMAP