REDUCE

15.1 Procedure Heading

Each procedure has a heading consisting of the word PROCEDURE (optionally preceded by the word ALGEBRAIC), followed by the name of the procedure to be defined, and followed by its formal parameters – the symbols that will be used in the body of the definition to illustrate what is to be done. There are three cases:

  1. No parameters. Simply follow the procedure name with a terminator (semicolon or dollar sign).
            procedure abc;

    When such a procedure is used in an expression or command, abc(), with empty parentheses, must be written.

  2. One parameter. Enclose it in parentheses or just leave at least one space, then follow with a terminator.
            procedure abc(x);

    or

            procedure abc x;

  3. More than one parameter. Enclose them in parentheses, separated by commas, then follow with a terminator.
            procedure abc(x,y,z);

Referring to the last example, if later in some expression being evaluated the symbols abc(u,p*q,123) appear, the operations of the procedure body will be carried out as if X had the same value as U does, Y the same value as p*q does, and Z the value 123. The values of X, Y, Z, after the procedure body operations are completed are unchanged. So, normally, are the values of U, P, Q, and (of course) 123. (This is technically referred to as call by value.)

The reader will have noted the word normally a few lines earlier. The call by value protections can be bypassed if necessary, as described elsewhere.