The fact that this is one of the longer chapters in the book reflects the importance of routines in Algol 68 programs. Every formula uses operators, and procedures enable a program to be written in small chunks and tested in a piecewise manner.
A routine denotation forms the basis of both operators and procedures. Routine denotations have a well-defined mode, the value being the denotation itself. A routine can declare identifiers within its body, including other routines (whether operators or procedures).
Operators can have one or two operands (as the parameters are
called) and usually yield a value of some mode other than
VOID
. Dyadic operators have a priority of 1
to 9. Firmly related operators cannot be declared in the same
range. The operator symbol can be a bold indicant (like a mode
indicant) or one of or a combination of various symbols.
Procedures can have none or more parameters of any mode, and can
yield a value of any mode (including VOID
). Procedures can
call themselves: this is known as recursion.
Rows of procedures, names of procedures and other modes using procedure modes can all be declared and, on occasion, can be useful.
Here are some exercises which cover some of the topics discussed in this rather long chapter.
pr
, which can be called by the
phrase pr(2)[2]
. Ans