next up previous contents
Next: Different types of Up: CHAPTER.4: PROCEDURES IN Previous: Precedence and parentheses

Defining new infix procedures

(Beginners should omit this section.)

Users may define their own new infix operators by specifying the precedence after the word `define'. E.g. to define an operation of precedence -3.5 /// which divides its first argument by the square of its second, and associates to the right:

    define -3.5 x /// y;
        x / (y * y)
    enddefine;

    3 /// 4 =>
    ** 0.1875
    4 /// 5 =>
    ** 0.16
    3 /// 4 /// 5 =>
    ** 117.187
    (3 /// 4) /// 5 =>
    ** 0.0075
Infix procedures are available for other purposes besides numerical operations. We have already seen that "<>" is an infix operation which can join two lists or two procedures together, for instance, and "matches" is an infix operation used for comparing two lists.

    identprops("matches") =>
    ** 8
The equality symbols "=" and "==" are also used as infix operators applicable to arbitrary objects.



Aaron Sloman
Fri Jan 2 03:17:44 GMT 1998