forallindexed

Command: forallindexed


Synopsis

[v1 ... vn] {f} forallindexed -> f(0 v1) ... f(n-1 vn)

References
The Red Book

File
sli/slicontrol.cc
Parameters

[v1 ... vn] - list of n arbitrary objects or string
{f} - function which can operate on the elements of the
array. f is not required to return a specific number
of values.

Author

Marc-Oliver Gewaltig

Description

For each element of the input array forallindexed calls f with
two arguments the element and its index within the list/string.
forallindexed is similar to forall only that the index of the
element is also passed to the function f.

Alternatives: Functions forallindexed_a for a list forallindexed_s
for a string (both undocumented) -> behaviour and synopsis are the same.

Examples


[(a) (b)] {} forallindexed -> (a) 0 (b) 1