File r37/lisp/csl/html/r37_0213.html artifact 6ae59ea6ce part of check-in a57e59ec0d



<A NAME=PRECEDENCE>

<TITLE>PRECEDENCE</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>PRECEDENCE</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>declaration</B><P>
<P>
 
 <P>
<P>
The <em>precedence</em> declaration attaches a precedence to an infix operator. 

 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>precedence</em>&lt;operator&gt;,&lt;known\_operator&gt; 
<P>
<P>
<P>
&lt;operator&gt; should have been declared an operator but may be a REDUCE 
identifier that is not already an operator, array, or matrix. 
&lt;known\_operator&gt; must be a system infix operator or have had its 
precedence already declared. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
operator f,h; 

precedence f,+; 

precedence h,*; 

a + f(1,2)*c; 

  (1 F 2)*C + A 


a + h(1,2)*c; 

  1 H 2*C + A 


a*1 f 2*c; 

  A F 2*C 


a*1 h 2*c; 

  1 H 2*A*C

</TT></PRE><P>The operator whose precedence is being declared is inserted into t
he infix 
operator precedence list at the next higher place than &lt;known\_operator&gt;. 

<P>
<P>
Attaching a precedence to an operator has the side effect of declaring the 
operator to be infix. If the identifier argument for <em>precedence</em> has 
not been declared to be an operator, an attempt to use it causes an error 
message. After declaring it to be an operator, it becomes an infix operator 
with the precedence previously given. Infix operators may be used in prefix 
form; if they are used in infix form, a space must be left on each side of 
the operator to avoid ambiguity. Declared infix operators are always binary. 
<P>
<P>
To see the infix operator precedence list, enter symbolic mode and type 
<em>preclis!*;</em>. The lowest precedence operator is listed first. 
<P>
<P>
All prefix operators have precedence higher than infix operators. 
<P>
<P>
<P>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]