INFIX INDEX

INFIX _ _ _ _ _ _ _ _ _ _ _ _ declaration

infixdeclares identifiers to be infix operators.

syntax:

infix<identifier>{,<identifier>}*

<identifier> can be any valid REDUCE identifier, which has not already been declared an operator, array or matrix, and is not reserved by the system.

examples:


infix aa; 

for all x,y let aa(x,y) = cos(x)*cos(y) - sin(x)*sin(y); 

x aa y; 

  COS(X)*COS(Y) - SIN(X)*SIN(Y) 


pi/3 aa pi/2; 

    SQRT(3)
  - ------- 
       2


aa(pi,pi); 

  1

A let statement must be used to attach functionality to the operator. Note that the operator is defined in prefix form in the let statement. After its definition, the operator may be used in either prefix or infix mode. The above operator aa finds the cosine of the sum of two angles by the formula

cos(x+y) = cos(x)*cos(y) - sin(x)*sin(y).

Precedence may be attached to infix operators with the precedence declaration.

User-defined 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. Infix operators are always binary.