<A NAME=MAP>
<TITLE>MAP</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>
<B>MAP</B> _ _ _ _ _ _ _ _ _ _ _ _ <B>operator</B><P>
<P>
<P>
<P>
The <em>map</em> operator applies a uniform evaluation pattern
to all members of a composite structure: a
<A HREF=r37_0345.html>matrix</A>,
a
<A HREF=r37_0053.html>list</A> or the arguments of an
<A HREF=r37_0211.html>operator</A> expression.
The evaluation pattern can be a
unary procedure, an operator, or an algebraic expression with
one free variable.
<P> <H3>
syntax: </H3>
<P>
<P>
<em>map</em>(<function>,<object>)
<P>
<P>
<P>
<object> is a list, a matrix or an operator expression.
<P>
<P>
<function> is
the name of an operator for a single argument: the operator
is evaluated once with each element of <object> as its single argument,
<P>
<P>
or an algebraic expression with exactly one
<A HREF=r37_0061.html>free variable</A>, that is
a variable preceded by the tilde symbol: the expression
is evaluated for each element of <object> where the element is
substituted for the free variable,
<P>
<P>
or a replacement
<A HREF=r37_0060.html>rule</A> of the form
<P> <H3>
syntax: </H3>
<P>
<P>
<em>var</em>=> <em>rep</em>
<P>
<P>
<P>
where <var> is a variable (a <kernel> without subscript)
and <rep> is an expression which contains <var>.
Here <em>rep</em> is evaluated for each element of <object> where
the element is substituted for <em>var</em>. <em>var</em> may be
optionally preceded by a tilde.
<P>
<P>
The rule form for <function> is needed when more than
one free variable occurs.
<P>
<P>
<P> <H3>
examples: </H3>
<P><PRE><TT>
map(abs,{1,-2,a,-a});
1,2,abs(a),abs(a)
map(int(~w,x), mat((x^2,x^5),(x^4,x^5)));
[ 3 6 ]
[ x x ]
[---- ----]
[ 3 6 ]
[ ]
[ 5 6 ]
[ x x ]
[---- ----]
[ 5 6 ]
map(~w*6, x^2/3 = y^3/2 -1);
2 3
2*x =3*(y -2)
</TT></PRE><P>You can use <em>map</em> in nested expressions. It is not allowed
to
apply <em>map</em> for a non-composed object, e.g. an identifier or a number.
<P>
<P>
<P>