<A NAME=SELECT>
<TITLE>SELECT</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>
<B>SELECT</B> _ _ _ _ _ _ _ _ _ _ _ _ <B>operator</B><P>
<P>
<P>
<P>
The <em>select</em> operator extracts from a list
or from the arguments of an n--ary operator elements corresponding
to a boolean predicate. The predicate pattern can be a
unary procedure, an operator or an algebraic expression with
one
<A HREF=r37_0061.html>free variable</A>.
<P> <H3>
syntax: </H3>
<P>
<P>
<em>select</em>(<function>,<object>)
<P>
<P>
<P>
<object> is a
<A HREF=r37_0053.html>list</A>.
<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. The evaluation result of <function> is
interpreted as
<A HREF=r37_0109.html>boolean value</A> corresponding to the conventions of
REDUCE. The result value is built with the leading operator of the
input expression.
<P> <H3>
examples: </H3>
<P><PRE><TT>
select( ~w>0 , {1,-1,2,-3,3})
{1,2,3}
q:=(part((x+y)^5,0):=list)
select(evenp deg(~w,y),q);
5 3 2 4
{x ,10*x *y ,5*x*y }
select(evenp deg(~w,x),2x^2+3x^3+4x^4);
2 4
2x +4x
</TT></PRE><P><P>
<P>