MTS 8: LISP and SLIP in MTS
June 1976
Since EVAL calls itself in order to determine the values of the
argument-designators, the argument-designators do not have to be
atoms, but can be any LISP form which will evaluate to the desired
argument. For example, if the VALUE of X is 2 and the VALUE of Y
is 3, then EVALing the form
(ADD X (ADD Y 1))
causes the function ADD to be invoked twice--the first time with
arguments 3 and 1, and the final time with arguments 2 and 4.
Naturally, the VALUEs of X and Y are not altered by this operation.
There are a number of built-in LISP functions which are invoked by
a direct call as described above. In addition, the user can define
new functions by composing these built-in functions in various
ways, and then the user-defined functions can also be invoked by
name.
Output and Termination: (STOP) and (MTS)
Whenever a LISP form is EVALed, a resulting value is returned.
When the system reads and EVALs a form, it prints its (top-level)
value before reading the next form. When it is said that only the
top-level value is printed, this means that the evaluation of
arguments, which may involve intermediate function calls, does not
cause anything to be printed. For example, if a user enters the
form
(ADD X (ADD Y 1))
where the VALUE of X is 2 and the VALUE of Y is 3, the system EVALs
this entire expression and prints the resulting value of 6.
Evaluating the form (STOP) at any level terminates execution of
LISP. Evaluating the form (MTS) returns control to MTS command
mode from which the user may subsequently restart LISP via the
$RESTART command.
Basic LISP Functions ____________________
(QUOTE S) and ’S
It is important to remember that when a LISP form appears as an
argument-designator in a function call, this signifies that the
value of the form is to be the argument of the function. However,
many times LISP users wish to specify directly what an argument to
a function should be. In order to facilitate this process, the
function QUOTE is available. The value of (QUOTE A) is the atom A.
The value of (QUOTE (CAR (A B C))) is the list (CAR (A B C)).
16 LISP