MTS 8: LISP and SLIP in MTS
June 1976
Functions That Create New LISP Structures
This section includes functions that create new LISP structures as
well as returning a value. Frequently, the value returned from a
function in this section is precisely the new LISP structure which
was created. Examples of these functions follow each description.
(CONS S1 S2) Returns the dotted pair of S1 and S2.
(CONS ’A ’B) = (A . B)
(CONS ’(A B C) ’(D E F)) = ((A B C)
.(D E F)) = ((A B C) D E F)
(CONS ’A ’(B C (D E))) = (A B C (D E))
(LIST S1...SN) Returns the list of S1 through SN.
(LIST ’A ’B) = (A B)
(LIST ’(A B C) ’(D E F)) = ((A B C) (D E F))
(LIST ’A ’(B C D)) = (A (B C D))
(EVLIS L) Evaluates each element of L and returns a list
of the values.
(EVLIS ’((ADD 3 1) (ADD 5 6))) = (4 11)
(CONC L1...LN) Returns a concatenated list of copies of lists
L1 through LN.
(CONC ’(A B C) ’(D E F)) = (A B C D E F)
(CONC ’(A B C) NIL ’(D E F)) = (A B C D E F)
(APPEND L S1...SN) Returns a copy of the list L, with S1 through
SN appended as elements to the end.
(APPEND ’(A B C) ’D ’E ’F) = (A B C D E F)
(APPEND ’(A B C) ’(D E) ’F) = (A B C (D E) F)
(APPEND NIL ’C ’D ’E) = (C D E)
(REVERSE L) Returns a list of the (top-level) elements of
L, in reverse order.
(REVERSE ’(A (B (C D)) E)) = (E (B (C D)) A)
(COPY S1 S2 S3) Returns a copy of structure S1. If arguments
S2 and S3 are given, each substructure of the
original structure (S1) which is EQUAL to S2
will be replaced by S3 in the copy. S2 need
not be a top-level element, but may be an
element at any level. If S2 appears without
S3, then all occurrences of S2 in the original
structure (except as the CDR of a dotted pair)
will be deleted in the copy. If the first
argument to COPY is a literal atom other than
20 LISP