[Next] [Up] [Previous]
Next: Procedures Up: Appendix: Programming in POP-11 Previous: Data Objects


POP-11 commands are instructions for the computer to perform some action on a specified data object. A simple action is to display the object on the screen; the command to do this is represented by the following symbol, called a print arrow: =>. You type it by pressing the = key and then the > key. To display a data object, you type the object, followed by a print arrow, e.g.,

[The cat sat on the mat] =>
** [The cat sat on the mat]

"cat" =>
** cat

In this book we shall indicate symbols typed in by the user in bold type and the responses produced by the program in normal type. The two stars merely indicate that the item has been displayed using the print arrow. The `pretty print' symbol =>>[+] will display lists without the outer brackets or the two stars:

[Welcome to the London Tourist Guide] =>>
Welcome to the London Tourist Guide

You can put spaces between items. An item is a single data object or symbol (e.g., cat or => ). Thus, you could write,

[ The cat sat on the mat ] =>
** [The cat sat on the mat]

POP-11 will not interpret the command correctly if you split items (e.g., if you type = > rather than => or c a t rather than cat).

Simply displaying an object on the screen is not a very exciting demonstration of the power of the computer, but commands can be applied not only to objects but also to combinations of objects, called expressions. An expression is a series of objects linked by operators. One familiar kind is the arithmetic expression, consisting of numbers linked by arithmetic operators such as + - / (for `divide') and * (for `multiply'). An expression followed by a print arrow instructs the computer to evaluate the expression and display the result, e.g.,

** 4

12 - 3 + 5 =>
** 14

POP-11 interprets a program by carrying out each command in turn, where necessary evaluating the expressions and applying the command to the result. When the last command has been interpreted, the program ends.

[Next] [Up] [Previous]
Next: Procedures Up: Appendix: Programming in POP-11 Previous: Data Objects

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