
<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>(&lt;function&gt;,&lt;object&gt;) 
<P>
<P>
<P>
&lt;object&gt; is a 
<A HREF=r37_0053.html>list</A>. 
<P>
<P>
&lt;function&gt; is 
the name of an operator for a single argument: the operator 
 is evaluated once with each element of &lt;object&gt; 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 &lt;object&gt; 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>=&gt; <em>rep</em> 
<P>
<P>
<P>
where &lt;var&gt; is a variable (a &lt;kernel&gt; without subscript) 
 and &lt;rep&gt; is an expression which contains &lt;var&gt;. 
 Here <em>rep</em> is evaluated for each element of &lt;object&gt; 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 &lt;function&gt; is needed when more than 
one free variable occurs. The evaluation result of &lt;function&gt; 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&gt;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>
