listp object [function]
-
-
returns T if object is an instance of cons or NIL.
consp object [function]
-
-
equivalent to (not (atom object)). (consp '()) is nil.
car list [function]
-
-
returns the first element in list. car of NIL is NIL.
car of atom is error.
cdr list [function]
-
- returns the list which removed the first element
of list. cdr of NIL is NIL.
cdr of atom is error.
cadr list [function]
-
-
cddr list [function]
-
-
cdar list [function]
-
-
caar list [function]
-
-
caddr list [function]
-
-
caadr list [function]
-
-
caaar list [function]
-
-
cdadr list [function]
-
-
cdadr list [function]
-
-
cdaar list [function]
-
-
cdddr list [function]
-
-
cdddr list [function]
-
-
cddar list [function]
-
-
first list [function]
-
- retrieves the first element in list.
second, third, fourth, fifth, sixth, seventh, eighth are also
available.
nth count list [function]
-
-
returns the count-th element in list.
Note that (nth 1 list) is equivalent to (second list),
and to (elt list 1).
nthcdr count list [function]
-
-
applies cdr count times to list.
last list [function]
-
-
the last cons is returned, not the last element.
butlast list &optional (n 1) [function]
-
- returns a list which does not contain the last n elements.
cons car cdr [function]
-
-
makes a new cons whose car is car and cdr is cdr.
list {element}* [function]
-
- makes a list of elements.
list* {element}* [function]
-
-
makes a list of elements, but the last element is consed in cdr:
for example, (list* 1 2 3 '(4 5)) = (1 2 3 4 5).
list-length list [function]
-
-
returns the length of the list. List can be circular.
make-list size &key (initial-element nil) [function]
-
-
makes a list whose length is size and elements are initial-element.
rplaca cons a [function]
-
-
replace the car of cons with a.
Use of setf to car is recommended.
rplacd cons d [function]
-
-
replace the cdr of cons with d.
Use of setf to cdr is recommended.
memq item list [function]
-
-
resembles member, but test is always done by eq.
member item list &key :key (:test #'eq) :test-not [function]
-
- The list is searched for an element that satisfies the test.
If none is found, NIL is returned; otherwise, the tail of list beginning
with the first element that satisfied the test is returned. The list
is searched on the top level only.
assq item alist [function]
-
-
assoc item alist &key :key (:test #'eq) :test-not [function]
-
- searches the association list alist. The value returned is the
first pair in the alist such that the car of the pair satisfies
the test, or NIL if there is no such pair in the alist.
rassoc item alist [function]
-
-
returns the first pair in alist whose cdr is equal to item.
pairlis l1 l2 &optional alist [function]
-
-
makes a list of pairs consing corresponding elements in l1 and l2.
If alist is given, it is concatenated at the tail of the pair list
made from l1 and l2.
acons key val alist [function]
-
-
add the key val pair to alist, that is,
(cons (cons key val) alist).
append {list}* [function]
-
-
appends list to form a new list.
All the elements in list, except the last list, are copied.
nconc {list}* [function]
-
-
concatenates list destructively by replacing the last cdr of each
list.
subst new old tree [function]
-
-
substitutes every old in tree with new.
flatten complex-list [function]
-
-
Complex-list composed of atoms and lists of any depth
is transformed into a single level linear list which have all the elements
in complex-list at the top level.
For example, (flatten '(a (b (c d) e))) = (a b c d e)
push item place [macro]
-
-
pushes item into a stack (list) bound to place.
pop stack [macro]
-
-
removes the first item from stack and returns it.
If stack is empty (nil), nil is returned.
pushnew item place &key test test-not key [macro]
-
-
pushes item in the place list
if item is not a member of place.
The test, test-not and key arguments are
passed to the member function.
adjoin item list [function]
-
-
The item is added at the head of the list if it is not included
in the list.
union list1 list2 &key (test #'eq) (test-not) (key #'identity) [function]
-
-
returns union set of two lists.
subsetp list1 list2 &key (test #'eq) (test-not) (key #'identity) [function]
-
- tests if list1 is a subset of list2, i.e. if each element
of list1 is a member of list2.
intersection list1 list2
&key (test #'eq) (test-not) (key #'identity) [function]
-
-
returns the intersection of two sets, list1 and list2.
set-difference list1 list2
&key (test #'eq) (test-not) (key #'identity) [function]
-
-
returns the list whose elements are only contained in list1
and not in list2.
set-exclusive-or list1 list2
&key (test #'eq) (test-not) (key #'identity) [function]
-
-
returns the list of elements that appear only either in list1 or list2.
list-insert item pos list [function]
-
-
Insert item as the pos'th element in list destructively.
If pos is bigger than the length of list, item is
nconc'ed at the tail.
For example, (list-insert 'x 2 '(a b c d)) = (a b x c d)
copy-tree tree [function]
-
-
returns the copy of tree which may be a nested list
but cannot have circular reference. Circular lists can be copied by
copy-object.
Actually, copy-tree is simply coded as (subst t t tree).
mapc func arg-list &rest more-arg-lists [function]
-
-
applies func to a list of N-th elements in arg-list and each of
more-arg-lists.
The results of application are ignored and arg-list is returned.
mapcar func &rest arg-list [function]
-
-
maps func to each element of arg-list,
and makes a list from all the results.
Before using mapcar, try dolist.
mapcan func arg-list &rest more-arg-lists [function]
-
- maps func to each element of arg-list,
and makes a list from all the results by nconc.
Mapcan is suitable for filtering (selecting) elements
in arg-list, since nconc does nothing with NIL.
k-okada
2013-05-21