MTS 8: LISP and SLIP in MTS
June 1976
(SETA ARR-ELT S) Sets the array element specified by ARR-ELT to
the value of S. ARR-ELT is an array element
specification of the same form used to get an
array element. SETA returns the value of S.
(SETA (B 3 4) ’(X Y) = (X Y), and the array
element (B 3 4) is set to (X Y).
(SETA (B (ADD 2 2) (SUB1 5)) (B (ADD 1 1) 3))
will return the value of (B 2 3), and the
array element (B 4 4) will be set to this
value.
(AND S1...SN) Evaluates the arguments S1 through SN in turn
until some Si has a value of NIL. AND then
stops evaluating and returns NIL. If no Si
has a value of NIL, AND returns the value of
SN.
(AND (CAR Z) (SETQ Z A) (SETQ X ’DONE)) has
the following effect: if (CAR Z) is NIL, AND
merely returns NIL; otherwise, Z is set to the
VALUE of A, and if the VALUE of A is NIL, then
AND returns NIL; otherwise, X is set to DONE,
and DONE is returned.
(OR S1...SN) Evaluates the arguments S1...SN until a value
which is not NIL is found. OR then returns
that value. If all of the arguments evaluate
to NIL, then OR returns NIL.
(OR (CAR Z) (SETQ Z A) (SETQ X ’DONE) (SETQ Y
NIL)) has the following effect: if ((CAR Z))
is non-NIL, returns CAR Z; otherwise, sets Z
to the VALUE of A. If the VALUE of A is
non-NIL, then returns that value. If the
VALUE of A is NIL, then sets X to DONE, and
returns DONE. Y will never be set to NIL.
(COND
(P1 S1...SN)
(P2 T1...TN)
.
.
(PN U1...UN)) This the basic conditional execution format
for LISP. The arguments to COND are one or
more COND-expressions of the form
(P S1...SN)
COND starts with the first COND-expression,
and evaluates P, which may be any LISP form.
If the value of P is non-NIL, COND will
30 LISP