Search                        Top                                  Index
HELP OPERATION                                          A. Sloman, Jan 1983

-- INFIX OPERATIONS ---------------------------------------------------

Infix operations are defined in POP-11 by using the word 'define'
followed by an integer specifying the syntax. Two formats are permitted,
as follows:

    define 4 x ++ y;
        conspair(front(x) + front(y), back(x) + back(y))
    enddefine;

and

    define 4 ++(x,y);
        conspair(front(x) + front(y), back(x) + back(y))
    enddefine;

These two formats are equivalent. Notice that if parentheses are not
used, and there are three identifiers, the SECOND one is taken to be the
name. If an infix operation is to take more than two arguments the
format using parentheses must be used in the definition, though
parentheses are not required in the call, e.g.

    define 6 list(p,q,r,s,t);
        [^p ^q ^r ^s ^t]
    enddefine;

    1, 2, 3, 4 list 5 =>
    ** [1 2 3 4 5]

See also HELP
    *DEFINE
    *INFIX      - for a definition of an infix operator
    *PRECEDENCE - for a list of infix operators with their precedences

REF *POPSYNTAX

--- C.all/help/operation -----------------------------------------------
--- Copyright University of Sussex 1987. All rights reserved. ----------