@node Lists, Streams and Reading, Characters, Top
@chapter Lists

@defun NINTERSECTION (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the intersection of LIST1 and LIST2.  LIST1 may be destroyed.


@end defun

@defun RASSOC-IF (predicate alist)
Package:LISP

Returns the first cons in ALIST whose cdr satisfies PREDICATE.


@end defun

@defun MAKE-LIST (size &key (initial-element nil))
Package:LISP

Creates and returns a list containing SIZE elements, each of which is
initialized to INITIAL-ELEMENT.


@end defun

@defun NTH (n list)
Package:LISP

Returns the N-th element of LIST, where the car of LIST is the zeroth
element.


@end defun

@defun CAAR (x)
Package:LISP

Equivalent to (CAR (CAR X)).


@end defun

@defun NULL (x)
Package:LISP

Returns T if X is NIL; NIL otherwise.


@end defun

@defun FIFTH (x)
Package:LISP

Equivalent to (CAR (CDDDDR X)).


@end defun

@defun NCONC (&rest lists)
Package:LISP

Concatenates LISTs by destructively modifying them.


@end defun

@defun TAILP (sublist list)
Package:LISP

Returns T if SUBLIST is one of the conses in LIST; NIL otherwise.


@end defun

@defun CONSP (x)
Package:LISP

Returns T if X is a cons; NIL otherwise.


@end defun

@defun TENTH (x)
Package:LISP

Equivalent to (CADR (CDDDDR (CDDDDR X))).


@end defun

@defun LISTP (x)
Package:LISP

Returns T if X is either a cons or NIL; NIL otherwise.


@end defun

@defun MAPCAN (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cars of LISTs, NCONCs the results, and returns it.


@end defun

@defun EIGHTH (x)
Package:LISP

Equivalent to (CADDDR (CDDDDR X)).


@end defun

@defun LENGTH (sequence)
Package:LISP

Returns the length of SEQUENCE.


@end defun

@defun RASSOC (item alist &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the first cons in ALIST whose cdr is equal to ITEM.


@end defun

@defun NSUBST-IF-NOT (new test tree &key (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that do not satisfy TEST.


@end defun

@defun NBUTLAST (list &optional (n 1))
Package:LISP

Changes the cdr of the N+1 th cons from the end of the list LIST to NIL.
Returns the whole list.


@end defun



@defun CDR (list)
Package:LISP

Returns the cdr of LIST.  Returns NIL if LIST is NIL.


@end defun

@defun MAPC (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cars of LISTs.  Returns the first LIST.


@end defun

@defun MAPL (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cdrs of LISTs.  Returns the first LIST.


@end defun

@defun CONS (x y)
Package:LISP

Returns a new cons whose car and cdr are X and Y, respectively.


@end defun

@defun LIST (&rest args)
Package:LISP

Returns a list of its arguments


@end defun


@defun THIRD (x)
Package:LISP

Equivalent to (CADDR X).


@end defun

@defun CDDAAR (x)
Package:LISP

Equivalent to (CDR (CDR (CAR (CAR X)))).


@end defun

@defun CDADAR (x)
Package:LISP

Equivalent to (CDR (CAR (CDR (CAR X)))).


@end defun

@defun CDAADR (x)
Package:LISP

Equivalent to (CDR (CAR (CAR (CDR X)))).


@end defun

@defun CADDAR (x)
Package:LISP

Equivalent to (CAR (CDR (CDR (CAR X)))).


@end defun

@defun CADADR (x)
Package:LISP

Equivalent to (CAR (CDR (CAR (CDR X)))).


@end defun

@defun CAADDR (x)
Package:LISP

Equivalent to (CAR (CAR (CDR (CDR X)))).


@end defun

@defun NTHCDR (n list)
Package:LISP

Returns the result of performing the CDR operation N times on LIST.


@end defun

@defun PAIRLIS (keys data &optional (alist nil))
Package:LISP

Constructs an association list from KEYS and DATA adding to ALIST.


@end defun

@defun SEVENTH (x)
Package:LISP

Equivalent to (CADDR (CDDDDR X)).


@end defun

@defun SUBSETP (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns T if every element of LIST1 appears in LIST2; NIL otherwise.


@end defun

@defun NSUBST-IF (new test tree &key (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that satisfy TEST.


@end defun

@defun COPY-LIST (list)
Package:LISP

Returns a new copy of LIST.


@end defun

@defun LAST (list)
Package:LISP

Returns the last cons in LIST


@end defun

@defun CAAAR (x)
Package:LISP

Equivalent to (CAR (CAR (CAR X))).


@end defun

@defun LIST-LENGTH (list)
Package:LISP

Returns the length of LIST, or NIL if LIST is circular.


@end defun

@defun CDDDR (x)
Package:LISP

Equivalent to (CDR (CDR (CDR X))).


@end defun

@defun INTERSECTION (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the intersection of List1 and List2.


@end defun

@defun NSUBST (new old tree &key (test #'eql) test-not (key #'identity))
Package:LISP

Substitutes NEW for subtrees in TREE that match OLD.


@end defun

@defun REVAPPEND (x y)
Package:LISP

Equivalent to (APPEND (REVERSE X) Y)


@end defun

@defun CDAR (x)
Package:LISP

Equivalent to (CDR (CAR X)).


@end defun

@defun CADR (x)
Package:LISP

Equivalent to (CAR (CDR X)).


@end defun

@defun REST (x)
Package:LISP

Equivalent to (CDR X).


@end defun

@defun NSET-EXCLUSIVE-OR (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns a list with elements which appear but once in LIST1 and LIST2.


@end defun

@defun ACONS (key datum alist)
Package:LISP

Constructs a new alist by adding the pair (KEY . DATUM) to ALIST.


@end defun

@defun SUBST-IF-NOT (new test tree &key (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that do not satisfy TEST.


@end defun

@defun RPLACA (x y)
Package:LISP

Replaces the car of X with Y, and returns the modified X.


@end defun

@defun SECOND (x)
Package:LISP

Equivalent to (CADR X).


@end defun

@defun NUNION (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the union of LIST1 and LIST2.  LIST1 and/or LIST2 may be destroyed.


@end defun

@defun BUTLAST (list &optional (n 1))
Package:LISP

Creates and returns a list with the same elements as LIST but without the
last N elements.


@end defun

@defun COPY-ALIST (alist)
Package:LISP
 Returns a new copy of ALIST.


@end defun

@defun SIXTH (x)
Package:LISP
 Equivalent to (CADR (CDDDDR X)).


@end defun

@defun CAAAAR (x)
Package:LISP

Equivalent to (CAR (CAR (CAR (CAR X)))).


@end defun

@defun CDDDAR (x)
Package:LISP

Equivalent to (CDR (CDR (CDR (CAR X)))).


@end defun

@defun CDDADR (x)
Package:LISP

Equivalent to (CDR (CDR (CAR (CDR X)))).


@end defun

@defun CDADDR (x)
Package:LISP

Equivalent to (CDR (CAR (CDR (CDR X)))).


@end defun

@defun CADDDR (x)
Package:LISP

Equivalent to (CAR (CDR (CDR (CDR X)))).


@end defun

@defun FOURTH (x)
Package:LISP

Equivalent to (CADDDR X).


@end defun

@defun NSUBLIS (alist tree &key (test #'eql) test-not (key #'identity))
Package:LISP

Substitutes from ALIST for subtrees of TREE.


@end defun

@defun SUBST-IF (new test tree &key (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that satisfy TEST.


@end defun

@defun NSET-DIFFERENCE (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns a list of elements of LIST1 that do not appear in LIST2.  LIST1 may
be destroyed.


@end defun

@deffn {Special Form} POP 
Package:LISP

Syntax:
@example
(pop place)
@end example

Pops one item off the front of the list in PLACE and returns it.


@end deffn

@deffn {Special Form} PUSH 
Package:LISP

Syntax:
@example
(push item place)
@end example

Conses ITEM onto the list in PLACE, and returns the new list.


@end deffn

@defun CDAAR (x)
Package:LISP

Equivalent to (CDR (CAR (CAR X))).


@end defun

@defun CADAR (x)
Package:LISP

Equivalent to (CAR (CDR (CAR X))).


@end defun

@defun CAADR (x)
Package:LISP

Equivalent to (CAR (CAR (CDR X))).


@end defun

@defun FIRST (x)
Package:LISP

Equivalent to (CAR X).


@end defun

@defun SUBST (new old tree &key (test #'eql) test-not (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that match OLD.


@end defun

@defun ADJOIN (item list &key (test #'eql) test-not (key #'identity))
Package:LISP

Adds ITEM to LIST unless ITEM is already a member of LIST.


@end defun

@defun MAPCON (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cdrs of LISTs, NCONCs the results, and returns it.


@end defun

@deffn {Macro} PUSHNEW 
Package:LISP

Syntax:
@example
(pushnew item place @{keyword value@}*)
@end example

If ITEM is already in the list stored in PLACE, does nothing.  Else, conses
ITEM onto the list.  Returns NIL.  If no KEYWORDs are supplied, each element
in the list is compared with ITEM by EQL, but the comparison can be controlled
by supplying keywords :TEST, :TEST-NOT, and/or :KEY.


@end deffn

@defun SET-EXCLUSIVE-OR (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns a list of elements appearing exactly once in LIST1 and LIST2.


@end defun

@defun TREE-EQUAL (x y &key (test #'eql) test-not)
Package:LISP

Returns T if X and Y are isomorphic trees with identical leaves.


@end defun

@defun CDDR (x)
Package:LISP

Equivalent to (CDR (CDR X)).


@end defun

@defun GETF (place indicator &optional (default nil))
Package:LISP

Searches the property list stored in Place for an indicator EQ to Indicator.
If one is found, the corresponding value is returned, else the Default is
returned.


@end defun

@defun LDIFF (list sublist)
Package:LISP

Returns a new list, whose elements are those of LIST that appear before
SUBLIST.  If SUBLIST is not a tail of LIST, a copy of LIST is returned.


@end defun

@defun UNION (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the union of LIST1 and LIST2.


@end defun

@defun ASSOC-IF-NOT (test alist)
Package:LISP

Returns the first pair in ALIST whose car does not satisfy TEST.


@end defun

@defun RPLACD (x y)
Package:LISP

Replaces the cdr of X with Y, and returns the modified X.


@end defun

@defun MEMBER-IF-NOT (test list &key (key #'identity))
Package:LISP

Returns the tail of LIST beginning with the first element not satisfying
TEST.


@end defun

@defun CAR (list)
Package:LISP

Returns the car of LIST.  Returns NIL if LIST is NIL.


@end defun

@defun ENDP (x)
Package:LISP

Returns T if X is NIL.  Returns NIL if X is a cons.  Otherwise, signals an
error.


@end defun

@defun LIST* (arg &rest others)
Package:LISP

Returns a list of its arguments with the last cons being a dotted pair of
the next to the last argument and the last argument.


@end defun

@defun NINTH (x)
Package:LISP

Equivalent to (CAR (CDDDDR (CDDDDR X))).


@end defun

@defun CDAAAR (x)
Package:LISP

Equivalent to (CDR (CAR (CAR (CAR X)))).


@end defun

@defun CADAAR (x)
Package:LISP

Equivalent to (CAR (CDR (CAR (CAR X)))).


@end defun

@defun CAADAR (x)
Package:LISP

Equivalent to (CAR (CAR (CDR (CAR X)))).


@end defun

@defun CAAADR (x)
Package:LISP

Equivalent to (CAR (CAR (CAR (CDR X)))).


@end defun

@defun CDDDDR (x)
Package:LISP

Equivalent to (CDR (CDR (CDR (CDR X)))).


@end defun

@defun SUBLIS (alist tree &key (test #'eql) test-not (key #'identity))
Package:LISP

Substitutes from ALIST for subtrees of TREE nondestructively.


@end defun

@defun RASSOC-IF-NOT (predicate alist)
Package:LISP

Returns the first cons in ALIST whose cdr does not satisfy PREDICATE.


@end defun

@defun NRECONC (x y)
Package:LISP

Equivalent to (NCONC (NREVERSE X) Y).


@end defun

@defun MAPLIST (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cdrs of LISTs and returns the results as a list.


@end defun

@defun SET-DIFFERENCE (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns a list of elements of LIST1 that do not appear in LIST2.


@end defun

@defun ASSOC-IF (test alist)
Package:LISP

Returns the first pair in ALIST whose car satisfies TEST.


@end defun

@defun GET-PROPERTIES (place indicator-list)
Package:LISP

Looks for the elements of INDICATOR-LIST in the property list stored in PLACE.
If found, returns the indicator, the value, and T as multiple-values.  If not,
returns NILs as its three values.


@end defun

@defun MEMBER-IF (test list &key (key #'identity))
Package:LISP

Returns the tail of LIST beginning with the first element satisfying TEST.


@end defun

@defun COPY-TREE (object)
Package:LISP

Recursively copies conses in OBJECT and returns the result.


@end defun

@defun ATOM (x)
Package:LISP

Returns T if X is not a cons; NIL otherwise.


@end defun

@defun CDDAR (x)
Package:LISP

Equivalent to (CDR (CDR (CAR X))).


@end defun

@defun CDADR (x)
Package:LISP

Equivalent to (CDR (CAR (CDR X))).


@end defun

@defun CADDR (x)
Package:LISP

Equivalent to (CAR (CDR (CDR X))).


@end defun

@defun ASSOC (item alist &key (test #'eql) test-not)
Package:LISP

Returns the first pair in ALIST whose car is equal (in the sense of TEST) to
ITEM.


@end defun

@defun APPEND (&rest lists)
Package:LISP

Constructs a new list by concatenating its arguments.


@end defun

@defun MEMBER (item list &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the tail of LIST beginning with the first ITEM.


@end defun
