**Name:**

MapIndexed - Apply a function to each element of a list/string

**Synopsis:**

[v1 ... vn] {f} MapIndexed -> [ f(v1,1) ... f(vn,n) ]

**Examples:**

[1 2 3 4 5] {add} MapIndexed -> [2 4 6 8 10]

(abcd) {add} MapIndexed -> (bdfh)

**Description:**

For each element of the input array, MapIndexed calls f with

two arguments, the current index and the element. It replaces

the element with the result of f.

MapIndexed works similar to Map, however, in adition to the

element its index within the array is also passed to the function.

Note that the index starts with 1, according to Mathematica convention.

This is unlike in forallindexed where in accordance with Postscript

array indices start with 0.

The result of MapIndexed is a list with the same number of values as the

argument list.

If f does not return a value, MapIndexed fails.

If f returns more than one value, the result of MapIndexed is

undefined.

Alternatives: Function MapIndexed_a for lists and MapIndexed_s

for strings (both undocumented) -> behaviour and synopsis are

the same.

**Parameters:**

[v1 ... vn] - list of n arbitrary objects or string.

{f} - function of two arguments and one return value.

**Bugs:**

**Diagnostics:**

None

**References:**

The Mathematica Book

**Author:**

Marc-Oliver Gewaltig

**SeeAlso:**

**Source:**

/home/nest/work/nest-2.14.0/lib/sli/mathematica.sli