MTS 8: LISP and SLIP in MTS
June 1976
(C D E F), and the VALUE of X is
(A B C D E F).
Note: The same changes in structures occur in
GRAFT as in RPLACA and RPLACD. Thus, the
warnings given in the note above apply to
GRAFT as well.
Operations on Property-Lists
Although the property-list of an atom is often treated as an
unordered collection of property-indicators and property-values, in
fact the PLIST of an atom is a normal LISP list of the form
(IND1 PVAL1...INDN PVALN). Examples of these operations follow
each description.
(PUT A,LA IND PVAL)
Gives the atom A, or all the atoms in the list
LA, the property IND with property-value PVAL.
If PVAL is omitted, a system default of T is
used. If an atom already has property IND on
its PLIST, then the previous PVAL associated
with property IND is replaced by the new PVAL.
The value returned from PUT is PVAL.
(PUT ’(A B) ’INCL ’X) = X
The property INCL with property-value X
is put on the PLIST of A and B.
(GET A IND) Returns the property-value associated with the
indicator IND on the PLIST of A. If A does
not have a property EQUAL to IND, GET returns
NIL.
(PUT ’A ’INCL ’(X Y)) = (X Y)
(GET ’A ’INCL) = (X Y)
(GET ’A ’NOTON) = NIL
Assumes NOTON is not on the PLIST of A.
(REM A,LA IND N) Removes up to N occurrences of the property
IND from the PLIST of the atom A, or all the
atoms in the list LA. If N is not given, all
occurrences are removed. The value of REM is
NIL.
(PUT ’A ’INCL ’(X Y)) = (X Y)
(GET ’A ’INCL) = (X Y)
(REM ’A ’INCL) = NIL
(GET ’A ’INCL) = NIL
24 LISP

MTS 8: LISP and SLIP in MTS
June 1976 Page Revised February 1979
(GETL A L) Finds the first indicator on the PLIST of A
which is a member of the list L. Returns the
sublist of the PLIST of A, starting with the
indicator which was found. If no such indica-
tor is found, GETL returns NIL.
For example, if the PLIST of BOOK is (COLOR
BLUE SIZE 367 TOPIC MATH), then
(GETL ’BOOK ’(WEIGHT TOPIC SIZE)) =
(SIZE 367 TOPIC MATH)
| (GETL ’BOOK ’(TOPIC)) = (TOPIC MATH)
| (GETL ’BOOK ’(WEIGHT)) = NIL
(ADDPROP A,LA IND PVAL)
Operates like PUT with the exception that a
new instance of IND is always placed on the
PLIST of A, or on the PLIST of each of the
atoms in LA. Thus, by using ADDPROP, it is
possible to have duplicate instances of one
property on the PLIST of an atom. Using
ADDPROP in conjunction with (REM A IND 1), the
user may operate a push-down stack of
property-values for a particular property.
(PUT ’A ’INCL ’X) = X
(ADDPROP ’A ’INCL ’Y) = Y
(GET ’A ’INCL) = Y
(REM ’A ’INCL 1) = NIL
(GET ’A ’INCL) = X
Basic Numeric Predicates
(GREATER N1...NN) Returns T if N1...NN is a strictly decreasing
sequence; otherwise, returns NIL.
(LESS N1...NN) Returns T if N1...NN is a strictly increasing
sequence; otherwise, returns NIL.
(ZERO N) Returns T if N=0; otherwise, returns NIL.
(EVEN N) Returns T if N is an even integer; otherwise,
returns NIL.
(INTEGER N) Returns T if N is an integer; otherwise
returns NIL. N must be a numeric atom.
Basic Numeric Operations
(LENGTH L) Returns the length of the list L. LENGTH of
an atom is 0.
LISP 25
Previous Page Next Page