MTM[Map] - Apply a function to a list of elements
|
Calling Sequence
|
|
Map(f,M1,...,Mn)
Map[k](f,M1,...,Mn)
|
|
Parameters
|
|
f
|
-
|
procedure
|
M1,...,Mn
|
-
|
Array, list, set, scalar
|
k
|
-
|
(optional) positive integer
|
|
|
|
|
Description
|
|
•
|
The function Map(f,M1,...,Mn) applies the function f to each element of M1, with extra arguments M2,...,Mn.
|
•
|
The function Map[k](f,M1,...,Mn) applies the function f to each element of Mk, with extra arguments M1,...,Mk-1,Mk+1,...,Mn.
|
•
|
For scalar Mk, the function Map[k](f,M1,...,Mn) is equivalent to f(M1,...,Mn).
|
|
|
Examples
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
|
|