step - luxembourg/muxcode-clm GitHub Wiki

STEP()

FUNCTION: step([<object>/]<attribute>,<list>,<step size>[,<input delim>[,<output delim>]])

<list> is a <input delim>-separated list of strings (e.g., A B C).

This is something of a cross between iter() and map() in that it breaks the given <list> down into <step size> chunks and evaluates [<object>]/<attribute> passes these elements to <attribute> as arguments %0, %1, etc. The number of elements in <list> does not need to be evenly-divisible by <step size>.

If no <input delim> is given, the default is a space. Likewise, if no <output delim> is given, the default is the <input delim>. The <step size> can range from 1 to 10. A <step size> of 1 is equivalent to use map().

Examples: > &print_line me = %r%0 -- %1 -- %2 > say step(print_line,1 2 3 4 5 6 7 8,3) You say, " 1 -- 2 -- 3 4 -- 5 -- 6 7 -- 8 --"

Related Topics: iter, map, mix, list