MTS 8: LISP and SLIP in MTS
Page Revised February 1979 June 1976
(PLEN A) Returns the length of the PNAME of the atom A.
A must be a literal atom or IOARG.
(ADD1 N) Returns N+1. N must be an integer.
(SUB1 N) Returns N-1. N must be an integer.
(MINUS N) Returns -N. N must be an integer.
(ABS N) Returns the absolute value of N. N must be an
integer.
(FIX N) Returns the integral (truncated) part of N.
(FLOAT N) Returns the floating-point equivalent of N.
(MAX N1...NN) Returns the algebraic maximum of N1...NN.
(MIN N1...NN) Returns the algebraic minimum of N1...NN.
(ADD N1...NN) Returns the sum of N1...NN.
(SUB N1 N2) Returns N1-N2.
(TIMES N1...NN) Returns the product of N1...NN.
(DIVIDE N1 N2) Returns the quotient of N1 and N2. Floating-
point division is performed.
(REMAIN N1 N2) Returns the remainder of N1/N2. N1 and N2
must be integers.
(IDIVIDE N1 N2) Returns the integer quotient of N1 and N2. N1
and N2 must be integers.
(ADDRESS S) Returns a numeric atom equal to the address of
the LISP structure S.
(SHIFT N1 N2) Returns the number N1, shifted N2 bits to the
left. N1 and N2 must be integers. If N2 is
negative, the effect is a shift to the right.
(SHIFT 32 -1) = 16
(SHIFT 3 2)= 12
(LAND N1 N2) Returns the result of a bitwise logical AND of
N1 and N2. N1 and N2 must be integers.
(LAND 3 5)=1
(LOR N1 N2) Returns the result of a bitwise logical OR of
N1 and N2. N1 and N2 must be integers.
26 LISP

MTS 8: LISP and SLIP in MTS
June 1976
(LOR 3 5)=7
(LXOR N1 N2) Returns the result of a bitwise logical
EXCLUSIVE-OR of N1 and N2. N1 and N2 must be
integers.
(LXOR 3 5)=6
(LXOR -1 3) = -4
Basic Control Functions
This section includes the functionals, which take as their argu-
ments definitions of functions to be invoked. Also included are
EVAL and PROGN, which control the evaluation of forms in LISP.
Examples of these functions follow each description.
(EVAL S) Evaluates S and returns the result.
For example, if the VALUE of X is (A B C), and
the VALUE of A is VALA, then (EVAL (CAR X)) =
VALA.
(PROGN S1...SN) Evaluates S1 through SN and returns the value
of SN, its last argument. This function is
useful when the user wants to do several
different things in one step, and wants only
the last result returned. For example, at the
top level, the user may wish to embed a number
of forms in a PROGN in order to suppress
printing of all but the last result.
(PROGN S1...SN ’DONE) = DONE
(REPEAT S N EQUFAIL)
Evaluates form S N times, or until the value
of S is EQUAL to EQUFAIL. REPEAT returns the
last computed value of S. If N is 0, REPEAT
does not evaluate S, but only returns NIL.
(SETQ N 1)
(REPEAT ’(SETQ N (ADD1 N)) 12) = 13, and
N = 13
(REPEAT ’(SETQ N (ADD1 N)) 12 2) = 2, and
N = 2
(APPLY FN L) Causes the function FN to be invoked, where L
is a list of its arguments. FN may be any
LISP function specification.
(APPLY ’CAR ’( (A B C) )) = A
(APPLY ’CONS (X Y )) = (X.Y)
LISP 27
Previous Page Next Page