[Next] [Up] [Previous]
Next: Mishaps Up: Appendix: Programming in POP-11 Previous: Commands


A procedure is a sequence of commands that have been given a name. To instruct the computer to interpret the commands (known as calling the procedure) you simply give the name of the procedure followed by parentheses. Most POP-11 procedures take inputs and return results. The inputs (called arguments) are put inside the parentheses when the procedure is called. The procedure length, for example, returns the length of a data object given as its argument:

length([the cat sat on the mat])=>
** 6

** 3

It is not necessary to know the detailed structure of a procedure in order to use it. In general, a procedure contains a complicated series of commands, and it would be very inconvenient to have to remember or repeat the commands each time you want to call it. Instead you merely have to remember the procedure's name and how it is used. You can imagine the procedure as a box, with a name, zero or more inputs, and zero or more outputs:

Cogsweb Project: luisgh@cogs.susx.ac.uk