(2009) Lisp Quick Reference - Burgemeister
(2009) Lisp Quick Reference - Burgemeister
cl Common
lisp
Bert Burgemeister
Common Lisp Quick Reference
Contents
1 Numbers 3 9.5 Control Flow . . . 19
1.1 Predicates . . . . 3 9.6 Iteration . . . . 20
1.2 Numeric Functns . 3 9.7 Loop Facility . . . 21
1.3 Logic Functions . 4
10 CLOS 23
1.4 Integer Functions . 5
10.1 Classes . . . . . 23
1.5 Implementation-
10.2 Generic Functns . 24
Dependent . . . . 6
10.3 Method Combi-
2 Characters 6 nation Types . . . 26
3 Strings 7 11 Conditions and Errors 27
4 Conses 8 12 Input/Output 29
4.1 Predicates . . . . 8 12.1 Predicates . . . . 29
4.2 Lists . . . . . . 8 12.2 Reader . . . . . 30
4.3 Association Lists . 9 12.3 Macro Chars . . . 31
4.4 Trees . . . . . . 10 12.4 Printer . . . . . 32
4.5 Sets . . . . . . 10 12.5 Format . . . . . 34
5 Arrays 10 12.6 Streams . . . . . 36
5.1 Predicates . . . . 10 12.7 Files . . . . . . 37
5.2 Array Functions . 10 13 Types and Classes 39
5.3 Vector Functions . 11
14 Packages and Symbols 41
6 Sequences 12
14.1 Predicates . . . . 41
6.1 Seq. Predicates . . 12 14.2 Packages . . . . 41
6.2 Seq. Functions . . 12 14.3 Symbols . . . . . 42
7 Hash Tables 14 14.4 Std Packages . . 43
8 Structures 15 15 Compiler 43
15.1 Predicates . . . . 43
9 Control Structure 15
15.2 Compilation . . . 43
9.1 Predicates . . . . 15
15.3 REPL & Debug . 44
9.2 Variables . . . . 16
15.4 Declarations . . . 45
9.3 Functions . . . . 16
9.4 Macros . . . . . 18 16 External Environment 46
Typographic Conventions
Fu M sO gF var co
name; name; name; name; name; ∗name∗; name
⊲ Symbol defined in Common Lisp; esp. function, macro,
special operator, generic function, variable, constant.
me ⊲ Literal text.
c
foo ⊲ Argument foo is not evaluated.
g
bar ⊲ Argument bar is possibly modified.
P∗ sO
foo ⊲ foo ∗ is evaluated as in progn; see p. 19.
2
Common Lisp Quick Reference
1 Numbers
1.1 Predicates
Fu
(= number + )
Fu
(/= number + )
⊲ T if all number s, or none, respectively, are equal in value.
Fu
(> number + )
Fu
(>= number + )
Fu
(< number + )
Fu
(<= number + )
⊲ Return T if number s are monotonically decreasing,
monotonically non-increasing, monotonically increasing, or
monotonically non-decreasing, respectively.
Fu
(minusp a)
Fu
(zerop a) ⊲ T if a < 0, a = 0, or a > 0, respectively.
Fu
(plusp a)
Fu
(evenp integer )
Fu ⊲ T if integer is even or odd, respectively.
(oddp integer)
Fu
(numberp foo)
Fu
(realp foo)
Fu
(rationalp foo)
Fu
(floatp foo) ⊲ T if foo is of indicated type.
Fu
(integerp foo)
Fu
(complexp foo)
Fu
(random-state-p foo)
3
Common Lisp Quick Reference
Fu
(asinh a)
Fu
(acosh a) ⊲ asinh a, acosh a, or atanh a, respectively.
Fu
(atanh a)
Fu
(cis a) ⊲ Return ei a = cos a + i sin a.
Fu
(conjugate a) ⊲ Return complex conjugate of a.
Fu
(max num + )
Fu ⊲ Greatest or least, respectively, of nums.
(min num + )
8 Fu Fu 9
>
>{round fround} >
>
< Fu Fu =
{floor ffloor}
( Fu Fu n [d 1 ])
>
>{ ceiling fceiling} >
>
: Fu Fu ;
{truncate ftruncate}
⊲ Return as integer or float, respectively, n/d rounded, or
rounded towards −∞, +∞, or 0, respectively; and remain-
2
der.
Fu ff
mod
( Fu n d)
rem
Fu Fu
⊲ Same as floor or truncate, respectively, but return re-
mainder only.
Fu
(random limit [state ∗random-state
var ])
⊲ Return non-negative random number less than limit, and
of the same type.
Fu ˆ ˜
(make-random-state {state NIL T} NIL )
⊲ Copy of random-state object state or of the current ran-
dom state; or a randomly initialized fresh random state.
var
∗random-state∗ ⊲ Current random state.
Fu
(float-sign num-a [num-b 1 ])
⊲ num-b with the sign of num-a.
Fu
(signum n)
⊲ Number of magnitude 1 representing sign or phase of n.
Fu
(numerator rational )
Fu
(denominator rational )
⊲ Numerator or denominator, respectively, of rational ’s
canonical form.
Fu
(realpart number )
Fu
(imagpart number )
⊲ Real part or imaginary part, respectively, of number .
Fu
(complex real [imag 0 ]) ⊲ Make a complex number.
Fu
(phase number ) ⊲ Angle of number ’s polar representation.
Fu
(abs n) ⊲ Return |n|.
Fu
(rational real )
Fu
(rationalize real )
⊲ Convert real to rational. Assume complete/limited accu-
racy for real .
Fu
(float real [prototype single-float ])
⊲ Convert real into float with type of prototype.
co
boole-1 ⊲ int-a.
co
boole-2 ⊲ int-b.
co
boole-c1 ⊲ ¬int-a.
co
boole-c2 ⊲ ¬int-b.
co
boole-set ⊲ All bits set.
co
boole-clr ⊲ All bits zero.
4
Common Lisp Quick Reference
co
boole-eqv ⊲ int-a ≡ int-b.
co
boole-and ⊲ int-a ∧ int-b.
co
boole-andc1 ⊲ ¬int-a ∧ int-b.
co
boole-andc2 ⊲ int-a ∧ ¬int-b.
co
boole-nand ⊲ ¬(int-a ∧ int-b).
co
boole-ior ⊲ int-a ∨ int-b.
co
boole-orc1 ⊲ ¬int-a ∨ int-b.
co
boole-orc2 ⊲ int-a ∨ ¬int-b.
co
boole-xor ⊲ ¬(int-a ≡ int-b).
co
boole-nor ⊲ ¬(int-a ∨ int-b).
Fu
(lognot integer ) ⊲ ¬integer .
Fu
(logeqv integer ∗ )
Fu
(logand integer ∗ )
⊲ Return value of exclusive-nored or anded integer s, re-
spectively. Without any integer , return −1.
Fu
(logandc1 int-a int-b) ⊲ ¬int-a ∧ int-b.
Fu
(logandc2 int-a int-b) ⊲ int-a ∧ ¬int-b.
Fu
(lognand int-a int-b) ⊲ ¬(int-a ∧ int-b).
Fu
(logxor integer ∗ )
Fu
(logior integer ∗ )
⊲ Return value of exclusive-ored or ored integer s, respec-
tively. Without any integer, return 0.
Fu
(logorc1 int-a int-b) ⊲ ¬int-a ∨ int-b.
Fu
(logorc2 int-a int-b) ⊲ int-a ∨ ¬int-b.
Fu
(lognor int-a int-b) ⊲ ¬(int-a ∨ int-b).
Fu
(logbitp i integer )
⊲ T if zero-indexed ith bit of integer is set.
Fu
(logtest int-a int-b)
⊲ Return T if there is any bit set in int-a which is set in
int-b as well.
Fu
(logcount int)
⊲ Number of 1 bits in int ≥ 0, number of 0 bits in int < 0.
5
Common Lisp Quick Reference
1.5 Implementation-Dependent
co 9
short-float >>
co =
single-float epsilon
co -
double-float>> negative-epsilon
co ;
long-float
⊲ Smallest possible number making a difference when
added or subtracted, respectively.
co 98
least-negative >
> >short-float
co => <
least-negative-normalized single-float
co -
least-positive >
> >
>double-float
co ;:
least-positive-normalized long-float
⊲ Available numbers closest to −0 or +0, respectively.
8
>short-float
co ff>>
<single-float
most-negative
co - double-float
most-positive >>long-float
>
:
fixnum
⊲ Available numbers closest to −∞ or +∞, respectively.
Fu
(decode-float n)
Fu
(integer-decode-float n)
⊲ Return significand, exponent, and sign of float n.
2 3
Fu
(scale-float n [i ]) ⊲ With n’s radix b, return nbi .
Fu
(float-radix n)
Fu
(float-digits n)
Fu
(float-precision n)
⊲ Radix, number of digits in that radix, or precision in that
radix, respectively, of float n.
Fu
(upgraded-complex-part-type foo [environment NIL ])
⊲ Type of most specialized complex number able to hold
parts of type foo.
2 Characters
Fu
(characterp foo)
Fu ⊲ T if argument is of indicated type.
(standard-char-p char )
Fu
(graphic-char-p character )
Fu
(alpha-char-p character )
Fu
(alphanumericp character )
⊲ T if character is visible, alphabetic, or alphanumeric, re-
spectively.
Fu
(upper-case-p character )
Fu
(lower-case-p character )
Fu
(both-case-p character )
⊲ Return T if character is uppercase, lowercase, or able to
be in another case, respectively.
Fu
(digit-char-p character [radix 10 ])
⊲ Return its weight if character is a digit, or NIL otherwise.
Fu
(char= character + )
Fu
(char/= character + )
⊲ Return T if all character s, or none, respectively, are equal.
Fu
(char-equal character + )
Fu
(char-not-equal character + )
⊲ Return T if all character s, or none, respectively, are equal
ignoring case.
Fu
(char> character + )
Fu
(char>= character + )
Fu
(char< character + )
Fu
(char<= character + )
⊲ Return T if character s are monotonically decreasing,
monotonically non-increasing, monotonically increasing, or
monotonically non-decreasing, respectively.
6
Common Lisp Quick Reference
Fu
(char-greaterp character + )
Fu
(char-not-lessp character + )
Fu
(char-lessp character + )
Fu
(char-not-greaterp character + )
⊲ Return T if character s are monotonically decreasing,
monotonically non-increasing, monotonically increasing, or
monotonically non-decreasing, respectively, ignoring case.
Fu
(char-upcase character )
Fu
(char-downcase character )
⊲ Return corresponding uppercase/lowercase character, re-
spectively.
Fu
(digit-char i [radix 10 ]) ⊲ Character representing digit i.
Fu
(char-name character )
⊲ Name of character if there is one, or NIL.
Fu
(name-char name)
⊲ Character with name if there is one, or NIL.
Fu
(char-int character )
Fu ⊲ Code of character .
(char-code character )
Fu
(code-char code) ⊲ Character with code.
co Fu
char-code-limit ⊲ Upper bound of (char-code char ), ≥ 96.
Fu
(character c) ⊲ Return #\c.
3 Strings
Strings can as well be manipulated by array and sequence functions,
see pages 10 and 12.
Fu
(stringp foo)
Fu ⊲ T if foo is of indicated type.
(simple-string-p foo)
8˛ 9
> ˛:start1 start-foo 0 >
Fu ff <˛˛
> >
=
string= :start2 start-bar 0
( Fu foo bar ˛˛ )
string-equal >
> :end1 end-foo >
:˛˛ NIL >
;
:end2 end-bar NIL
⊲ Return T if subsequences of foo and bar are equal.
Obey/ignore, respectively, case.
8 Fu 9 8˛ 9
>string/= > ˛:start1 start-foo 0 >
> Fu
> >
> >
>˛ >
<string> = <˛ =
Fu :start2 start-bar 0
( string>= foo bar ˛˛ )
>
> Fu >
> >
>˛ :end1 end-foo NIL >>
>string<
: >
; :˛ ;
Fu :end2 end-bar NIL
string<=
⊲ If foo is lexicographically not equal, greater, not less, less,
or not greater, respectively, then return character number
from beginning of foo where they begin to differ. Otherwise
return NIL.
8 Fu 9 8˛ 9
>string-not-equal > ˛:start1 start-foo 0 >
> Fu
>string-greaterp >
> >
>˛ >
< Fu
= <˛:start2 start-bar 0 =
( string-not-lessp foo bar ˛˛ )
>
>
>
Fu
string-lessp
>
>
>
>
>
:˛:end1 end-foo NIL > >
;
: Fu ; ˛:end2 end-bar NIL
string-not-greaterp
⊲ If foo is lexicographically not equal, greater, not less,
less, or not greater, respectively, ignoring case, then return
character number from beginning of foo where they begin
to differ. Otherwise return NIL.
Fu
(string x )
⊲ Convert x (symbol, string, or character) into a string.
˛ ff
Fu ˛:initial-element char
(make-string size ˛˛ )
:element-type type character
⊲ Return string of length size.
8 9
Fu ff <capitalize= ˛ ff
string ˛:start start 0
( Fu - upcase string ˛˛ )
nstring : ; :end end NIL
downcase
⊲ Return string (not modified or modified, respectively)
with first letter of every word turned into uppercase, letters
all uppercase, or letters all lowercase, respectively.
7
Common Lisp Quick Reference
8 Fu 9
<string-trim
Fu
=
( string-left-trim char-bag string)
: Fu ;
string-right-trim
⊲ Return string with all characters in sequence char-bag
removed from both ends, from the beginning, or from the
end, respectively.
Fu
(char string i )
Fu
(schar string i )
⊲ Return zero-indexed ith character of string ignor-
ing/obeying, respectively, fill pointer. setfable.
8˛ 9
> ˛:start start 0 >
<˛˛
> >
=
Fu
˛ :end end NIL
(parse-integer string ˛ )
>
> :radix int >
:˛˛ 10 >
;
:junk-allowed bool NIL
⊲ Return integer parsed from string and index of parse end.
2
4 Conses
4.1 Predicates
Fu
(consp foo)
Fu ⊲ Return T if foo is of indicated type.
(listp foo)
Fu
(endp list)
Fu ⊲ Return T if list/foo is NIL.
(null foo)
Fu
(atom foo) ⊲ Return T if foo is not a cons.
Fu
(tailp foo list) ⊲ Return T if foo is a tail of list.
8˛ 9
<˛˛ :test function #’eql =
Fu
(member foo list ˛˛ :test-not function )
:˛ ;
:key function
⊲ Return tail of list starting with its first element matching
foo. Return NIL if there is no such element.
Fu ff
member-if
( Fu test list [:key function])
member-if-not
⊲ Return tail of list starting with its first element satisfying
test. Return NIL if there is no such element.
8˛ 9
<˛˛ :test function #’eql =
Fu
(subsetp list-a list-b ˛˛ :test-not function )
:˛ ;
:key function
⊲ Return T if list-a is a subset of list-b.
4.2 Lists
Fu
(cons foo bar ) ⊲ Return new cons (foo . bar ).
Fu
(list foo ∗ ) ⊲ Return list of foos.
Fu
(list∗ foo + )
⊲ Return list of foo s with last foo becoming cdr of last cons.
Return foo if only one foo given.
Fu
(make-list num [:initial-element foo NIL ])
⊲ New list with num elements set to foo.
Fu
(list-length list) ⊲ Length of list; NIL for circular list.
Fu
(car list) ⊲ car of list or NIL if list is NIL. setfable.
Fu
(cdr list)
Fu ⊲ cdr of list or NIL if list is NIL. setfable.
(rest list)
Fu Fu
(nthcdr n list) ⊲ Return tail of list after calling cdr n times.
Fu Fu Fu Fu Fu Fu Fu Fu
({first second third fourth fifth sixth . . . ninth tenth} list )
⊲ Return nth element of list if any, or NIL otherwise.
setfable.
Fu
(nth n list)
⊲ Return zero-indexed nth element of list. setfable.
8
Common Lisp Quick Reference
Fu
(cX r list)
Fu
⊲ With X being one to four as and ds representing cars
Fu Fu Fu Fu
and cdrs, e.g. (cadr bar ) is equivalent to (car (cdr bar )).
setfable.
Fu
(last list [num 1 ]) ⊲ Return list of last num conses of list.
Fu ff
butlast list
( Fu f [num 1 ])
nbutlast list
⊲ Return list excluding last num conses.
Fu ff
rplaca
( Fu g object)
cons
rplacd
⊲ Replace car, or cdr, respectively, of cons with object.
Fu
(ldiff list foo)
⊲ If foo is a tail of list, return preceding part of list . Oth-
erwise return list .
8˛ 9
<˛˛ :test function #’eql =
Fu
˛
(adjoin foo list ˛ :test-not function )
:˛ ;
:key function
⊲ Return list if foo is already member of list. If not, return
Fu
(cons foo list ).
M
]
(pop place)
Fu Fu
⊲ Set place to (cdr place ), return (car place ).
M
]
(push foo place)
Fu
⊲ Set place to (cons foo place ).
8˛ 9
<˛˛ :test function #’eql =
M
] ˛ :test-not function )
(pushnew foo place
:˛˛ ;
:key function
Fu
⊲ Set place to (adjoin foo place ).
Fu
(append [list ∗ foo])
Fu
f ∗ foo])
(nconc [list
⊲ Return concatenated list. foo can be of any type.
Fu
(revappend list foo)
Fu
f foo)
(nreconc list
⊲ Return concatenated list after reversing order in list.
Fu ff
mapcar
( Fu function list + )
maplist
⊲ Return list of return values of function successively in-
voked with corresponding arguments, either cars or cdrs,
respectively, from each list .
Fu ff
mapcan
( Fu function list + )
mapcon
⊲ Return list of concatenated return values of function suc-
cessively invoked with corresponding arguments, either cars
or cdrs, respectively, from each list. function should return
a list.
Fu ff
mapc
( Fu function list + )
mapl
⊲ Return first list after successively applying function to
corresponding arguments, either cars or cdrs, respectively,
from each list. function should have some side effects.
Fu
(copy-list list) ⊲ Return copy of list with shared elements.
9
Common Lisp Quick Reference
4.4 Trees
ff
Fu :test test #’eql
(tree-equal foo bar )
:test-not test
⊲ Return T if trees foo and bar have same shape and leaves
satisfying test.
8˛ 9
Fu ff <˛ :test function #’eql =
subst new old tree ˛
( Fu ˛
g :˛˛ :test-not function ;)
nsubst new old tree
:key function
⊲ Make copy of tree with each subtree or leaf matching old
replaced by new .
Fu ff
subst-if[-not] new test tree
( Fu g [:key function])
nsubst-if[-not] new test tree
⊲ Make copy of tree with each subtree or leaf satisfying test
replaced by new .
8˛ 9
Fu ff <˛ :test function #’eql =
sublis association-list tree ˛
( Fu ˛
g :˛˛ :test-not function ;)
nsublis association-list tree
:key function
⊲ Make copy of tree with each subtree or leaf matching a
key in association-list replaced by that key’s value.
Fu
(copy-tree tree) ⊲ Copy of tree with same shape and leaves.
4.5 Sets
8 Fu 9 9
>intersection > > >
>
> Fu = >
>
>
>set-difference >
>
>
> Fu a b >
> 8˛ 9
>
>union >
> >
>
< Fu ; = <˛˛ :test function #’eql =
set-exclusive-orff ˛ :test-not function )
( Fu
>
>nintersection > :˛˛ ;
> Fu
> eb >
a >
> :key function
>
>nset-difference ff >
>
>
> Fu >
>
:nunion
> Fu ee
a
>
b;
nset-exclusive-or
⊲ Return a ∩ b, a \ b, a ∪ b, or a △ b, respectively, of lists a
and b.
5 Arrays
5.1 Predicates
Fu
(arrayp foo)
Fu
(vectorp foo)
Fu
(simple-vector-p foo) ⊲ T if foo is of indicated type.
Fu
(bit-vector-p foo)
Fu
(simple-bit-vector-p foo)
Fu
(adjustable-array-p array )
Fu
(array-has-fill-pointer-p array)
⊲ Return T if array is adjustable/has a fill pointer, respec-
tively.
Fu
(array-in-bounds-p array [subscripts])
⊲ Return T if subscripts are in array ’s bounds.
10
Common Lisp Quick Reference
Fu
(array-row-major-index array [subscripts])
⊲ Index in row-major order of the element denoted by
subscripts.
Fu
(array-dimensions array )
⊲ List containing the lengths of array ’s dimensions.
Fu
(array-dimension array i)
⊲ Length of i th dimension of array .
Fu
(array-total-size array ) ⊲ Number of elements in array .
Fu
(array-rank array ) ⊲ Number of dimensions of array .
Fu
(array-displacement array ) ⊲ Target array and offset.
2
Fu
(bit bit-array [subscripts])
Fu
(sbit simple-bit-array [subscripts])
⊲ Return element of bit-array or of simple-bit-array. setf-
able.
Fu
^ [result-bit-array
(bit-not bit-array ^ NIL ])
⊲ Return result of bitwise negation of bit-array. If
result-bit-array is T, put result in bit-array; if it is NIL,
make a new array for result.
8 Fu 9
>bit-eqv >
> Fu
> >
>
>bit-and > >
>
> Fu
>bit-andc1 >
>
>
> >
>
>
> Fu >
>
>bit-andc2
> Fu >
>
< =
bit-nand ^ ^
( Fu bit-array-a bit-array-b [result-bit-array NIL ])
>bit-ior
> Fu >
>
>
> >
>
>bit-orc1
> >
>
>
> Fu >
>
>bit-orc2
>
> Fu
>
>
>
>
>bit-xor >
>
: Fu ;
bit-nor
⊲ Return result of bitwise logical operations (cf. opera-
Fu
tions of boole, p. 4) on bit-array-a and bit-array-b. If
result-bit-array is T, put result in bit-array-a; if it is NIL,
make a new array for result.
co
array-rank-limit ⊲ Upper bound of array rank, ≥ 8.
co
array-dimension-limit
⊲ Upper bound of an array dimension, ≥ 1024.
co
array-total-size-limit ⊲ Upper bound of array size, ≥ 1024.
Fu
^)
(vector-push foo vector
⊲ Return NIL if vector ’s fill pointer equals size of vector .
Otherwise replace element of vector pointed to by fill
pointer with foo; then increment fill pointer.
Fu
^ [num])
(vector-push-extend foo vector
⊲ Replace element of vector pointed to by fill pointer with
foo, then increment fill pointer. Extend vector ’s size by
≥ num if necessary.
Fu
^)
(vector-pop vector
⊲ Return element of vector its fillpointer points to after
decrementation.
Fu
(fill-pointer vector ) ⊲ Fill pointer of vector . setfable.
11
Common Lisp Quick Reference
6 Sequences
6.1 Sequence Predicates
Fu ff
every
( Fu test sequence + )
notevery
⊲ Return NIL or T, respectively, as soon as test on any set
of corresponding elements of sequences returns NIL.
Fu ff
some
( Fu test sequence + )
notany
⊲ Return value of test or NIL, respectively, as soon as test
on any set of corresponding elements of sequences returns
non-NIL.
8˛ 9
> ˛:from-end bool NIL >
>˛
> >
>
> ˛ :test function #’eql >
>
>
>˛˛ :test-not function >
> >
>
> >
>
<˛ =
Fu ˛:start1 start-a 0
(mismatch sequence-a sequence-b ˛ )
>
> ˛:start2 start-b 0 >
>
>˛˛:end1 end-a NIL
> >
>
>
> >
>
>˛
> >
>
:˛˛:end2 end-b NIL
> >
;
:key function
⊲ Return position in sequence-a where sequence-a and
sequence-b begin to mismatch. Return NIL if they match
entirely.
12
Common Lisp Quick Reference
8˛ 9
> ˛:from-end bool NIL >
>
> ˛ >
>
> ˛ :test test #’eql >>
>
Fu ff <˛˛
> >
=
find ˛ :test-not test
( Fu foo sequence ˛ )
position >
> ˛:start start 0 >
>
>
>˛:end end NIL >
>
>
> >
:˛˛ >
;
:key function
⊲ Return first element in sequence which satisfies test, or
its position relative to the begin of sequence, respectively.
8 Fu 9 8˛ 9
>find-if > > ˛:from-end bool NIL >
>
< Fu >
= <˛˛
> >
=
find-if-not :start start 0
( Fu test sequence ˛˛ )
>
>position-if >
> >
> :end end >
: Fu ; :˛˛ NIL >
;
position-if-not :key function
⊲ Return first element in sequence which satisfies test, or
its position relative to the begin of sequence, respectively.
8˛ 9
> ˛:from-end bool NIL >
>
> ˛ >
>
>
> ˛ :test function #’eql >
>
>
> ˛ >
>
> ˛ :test-not function > >
>
< ˛ =
Fu ˛:start1 start-a 0
(search sequence-a sequence-b ˛ )
>
> ˛:start2 start-b 0 >
>
>˛
> >
>
>
> ˛:end1 end-a NIL >
>
>˛˛:end2 end-b NIL
> >
>
>
:˛ >
;
:key function
⊲ Search sequence-b for a subsequence matching
sequence-a. Return position in sequence-b, or NIL.
8˛ 9
> ˛:from-end bool NIL >
>
> ˛ >
>
> ˛ >
>
>
> ˛ :test function #’eql >
>
Fu ff<>˛ :test-not function > >
=
remove foo sequence ˛
( Fu ˛:start start 0 )
^
delete foo sequence >˛˛ >
>
> :end end >
>
>
> ˛ NIL >
>
>˛:key function
> >
>
:˛˛
> >
;
:count count NIL
⊲ Make copy of sequence without elements matching foo.
8 Fu ff 98˛ 9
> ˛:from-end bool NIL >
>remove-if
>
< Fu
>
test sequence>
=
>
> ˛
<˛:start start 0
>
>
=
remove-if-notff ˛
( Fu ˛:end end NIL )
>
>delete-if >> ˛ >
: Fu ^ >
test sequence ;>
:˛˛:key function
> >
>
;
delete-if-not
:count count NIL
⊲ Make copy of sequence with all (or count ) elements sat-
isfying test removed.
8˛ 9
> ˛:from-end bool NIL >
>
> ˛ >
>˛ :test function #’eql >>
Fu ff>
<˛˛
> >
>
=
remove-duplicates sequence ˛ :test-not function
( Fu ˛ )
^
delete-duplicates sequence >
> ˛:start start 0 >
>
>
>˛:end end NIL >
>
>
> >
:˛˛ >
;
:key function
⊲ Make copy of sequence without duplicates.
8˛ 9
> ˛:from-end bool NIL >
>˛
> >
>
> ˛ :test function #’eql >
>
>
>˛˛
> >
>
Fu ff><˛ :test-not function > =
substitute new old sequence ˛:start start 0
( Fu ˛ )
^
nsubstitute new old sequence >
> >
>˛˛:end end NIL
>
>
>
>
>
> ˛ >
>
>˛:key function
>
:
>
>
;
˛:count count NIL
⊲ Make copy of sequence with all (or count ) olds replaced
by new .
8 Fu ff 9 8˛ 9
> ˛:from-end bool NIL >
>substitute-if
>
< Fu new test sequence >
>
=
>
> ˛
<˛:start start 0
>
>
=
substitute-if-not ff ˛
( Fu ˛:end end NIL )
>
>nsubstitute-if > > ˛ >
: Fu ^ >
new test sequence ; >
>
:˛˛:key function >
>
;
nsubstitute-if-not
:count count NIL
⊲ Make copy of sequence with all (or count ) elements sat-
isfying test replaced by new .
8˛ 9
> ˛:start1 start-a 0 >
>
<˛˛ >
=
Fu :start2 start-b 0
^
(replace sequence-a sequence-b ˛˛ )
>
> :end1 end-a NIL >
:˛˛ >
;
:end2 end-b NIL
⊲ Replace elements of sequence-a with elements of
sequence-b.
13
Common Lisp Quick Reference
Fu
(map type function sequence + )
⊲ Apply function successively to corresponding elements of
the sequences. Return values as a sequence of type. If type
is NIL, return NIL.
Fu
^
(map-into result-sequence function sequence ∗ )
⊲ Store into result-sequence successively values of function
applied to corresponding elements of the sequences.
8˛ 9
> ˛:initial-value foo NIL >
>˛
> >
<˛:from-end bool NIL > =
Fu ˛
(reduce function sequence ˛:start start 0 )
>
> ˛ >
>
>˛:end end NIL
: >
;
˛
:key function
⊲ Starting with the first two elements of sequence, apply
function successively to its last return value together with
the next element of sequence. Return last value of function.
Fu
(copy-seq sequence)
⊲ Return copy of sequence with shared elements.
7 Hash Tables
Key-value storage similar to hash tables can as well be achieved us-
ing association lists and property lists; see pages 9 and 16.
Fu
(hash-table-p foo) ⊲ Return T if foo is of type hash-table.
8˛ 9
> ˛:test {Fu Fu Fu Fu
eq eql equal equalp} #’eql >
>
<˛˛ >
=
Fu :size int
(make-hash-table ˛˛ )
>
>˛ :rehash-size num >
>
: ˛:rehash-threshold num ;
⊲ Make a hash table.
Fu
(gethash key hash-table [default NIL ])
⊲ Return object with key if any or default otherwise; and
T if found, NIL otherwise. setfable.
2 2
Fu
(hash-table-count hash-table)
⊲ Number of entries in hash-table.
Fu
^
(remhash key hash-table)
⊲ Remove from hash-table entry with key and return T if it
existed. Return NIL otherwise.
Fu
^
(clrhash hash-table) ⊲ Empty hash-table.
Fu
(maphash function hash-table)
⊲ Iterate over hash-table calling function on key and value.
Return NIL.
M
d ∗ )∗ formP∗ )
(with-hash-table-iterator (foo hash-table) (declare decl
⊲ Return values of form s. In forms, invocations of (foo)
return: T if an entry is returned; its key; its value.
Fu
(hash-table-test hash-table)
⊲ Test function used in hash-table.
Fu
(hash-table-size hash-table)
Fu
(hash-table-rehash-size hash-table)
Fu
(hash-table-rehash-threshold hash-table)
⊲ Current size, rehash-size, or rehash-threshold, respec-
Fu
tively, as used in make-hash-table.
Fu
(sxhash foo)
Fu
⊲ Hash code unique for any argument equal foo.
14
Common Lisp Quick Reference
8 Structures
M
n
(defstruct foo (foo
8˛ ( 9
> ˛ :conc-name >
>
> ˛ >
>
>
> ˛ (:conc-name [ \ foo- ])
slot-prefix >
>
>
> ˛ >
>
>˛(
> )∗ >
>
>
> ˛ :constructor >
>
>
> ˛ ˆ ˜ >
>
> ˛
>˛ (:constructor maker\ MAKE-foo [(ord-λ [ )] )
∗ >
>
>
> >
>
>
> ˛( >
>
>˛ :copier
> >
>
>
> ˛ >
>
> ˛ \ COPY-foo ])
>˛ (:copier [copier >
>
>
> >
>
>
> ˛ 8 9∗ >
>
>
> ˛ > d > >
>
<˛ <slot ˛ ff = = o
˛(:include s\truct ˛:type type
d )
˛ d ˛ )
>
> ˛ >
:(slot [init ˛:read-only bool >
d ]); > >
>˛
> >
>
>
> ˛8 8 9 >
>
>
> ˛> <list = ˛˛ >
>
>
> ˛>
> :named >
>
>
> ˛>
> (:type vector ) ˛ >
>
>˛<
> : ; ˛(:initial-offset n
b ) >
>
> ˛
>˛ ( d
(vector size) >
>
>
> >
>
>
> ˛>
> \ >
>
>˛>
> > (:print-object [o-printer ]) >
>
>
> ˛>
: >
>
> \ ])
>˛ (:print-function [f-printer >
>
>
> ˛ >
>
>
> ˛ :predicate >
>
>
:˛˛ >
;
\ foo-P ])
(:predicate [p-name
8 9∗
<slot ˛ ff =
d
[doc] ˛:type type
d )
:(slot [init ˛˛ d ]);
:read-only bool
⊲ Define structure type foo together with functions
MAKE-foo, COPY-foo and (unless :type without :named is
used) foo-P; and setfable accessors foo-slot . Instances of
type foo can be created by (MAKE-foo {:slot value}∗ ) or, if
ord-λ (see p. 16) is given, by (maker arg ∗ {:key value}∗ ). In
the latter case, arg s and :keys correspond to the positional
and keyword parameters defined in ord-λ whose var s in
turn correspond to slot s. :print-object/:print-function gen-
gF
erate a print-object method for an instance bar of foo calling
(o-printer bar stream) or (f-printer bar stream print-level),
respectively.
Fu
(copy-structure structure)
⊲ Return copy of structure with shared slot values.
9 Control Structure
9.1 Predicates
Fu
(eq foo bar ) ⊲ T if foo and bar are identical.
Fu
(eql foo bar )
⊲ T if foo and bar are identical, or the same character, or
numbers of the same type and value.
Fu
(equal foo bar )
Fu
⊲ T if foo and bar are eql, or are equivalent pathnames,
Fu
or are conses with equal cars and cdrs, or are strings or
Fu
bit-vectors with eql elements below their fill pointers.
Fu
(equalp foo bar )
⊲ T if foo and bar are identical; or are the same character
ignoring case; or are numbers of the same value ignoring
type; or are equivalent pathnames; or are conses or arrays
Fu
of the same shape with equalp elements; or are structures
of the same type with equalp elements; or are hash-tables of
the same size with the same :test function, the same keys
in terms of :test function, and equalp elements.
Fu
(not foo) ⊲ T if foo is NIL, NIL otherwise.
Fu
(boundp symbol ) ⊲ T if symbol is a special variable.
Fu
(constantp foo [environment NIL ])
⊲ T if foo is a constant form.
Fu
(functionp foo) ⊲ T if foo is of type function.
ff
Fu foo
(fboundp ) ⊲ T if foo is a global function or macro.
(setf foo)
15
Common Lisp Quick Reference
9.2 Variables
M ff
defconstant c form [doc])
d
( M foo
defparameter
⊲ Assign value of form to global constant/dynamic variable
foo.
M ˆ ˜
c form [doc]
(defvar foo d )
⊲ Unless bound already, assign value of form to dynamic
variable foo.
M ff
setf
( M {place form}∗ )
psetf
⊲ Set places to primary values of forms. Return values of
last form /NIL; work sequentially/in parallel, respectively.
sO ff
setq
( M {symbol form}∗ )
psetq
⊲ Set symbol s to primary values of forms. Return value of
last form /NIL; work sequentially/in parallel, respectively.
Fu
^ foo)
(set symbol
⊲ Set symbol ’s value cell to foo. Deprecated.
M
(multiple-value-setq vars form)
⊲ Set elements of vars to the values of form. Return form ’s
primary value.
M
] + foo)
(shiftf place
⊲ Store value of foo in rightmost place shifting values of
places left, returning first place .
M
] ∗)
(rotatef place
⊲ Rotate values of places left, old first becoming new last
place’s value. Return NIL.
Fu
(makunbound foo)f ⊲ Delete special variable foo if any.
Fu ˆ ˜
(get symbol keyˆ default NIL˜ )
Fu
(getf place key default NIL )
⊲ First entry key from property list stored in symbol /in
place, respectively, or default if there is no key. setfable.
Fu
(get-properties property-list keys)
⊲ Return key and value of first entry from property-list
2
matching a key from keys, and tail of property-list start-
3
ing with that key. Return NIL, NIL, and NIL if there was no
2 3
matching key in property-list .
Fu
^ key)
(remprop symbol
M
] key)
(remf place
⊲ Remove first entry key from property list stored in
symbol /in place, respectively. Return T if key was there,
or NIL otherwise.
9.3 Functions
Below, ordinary lambda
list (ord-λ∗ ) has the ff form
ˆ ∗˜
∗ var ˆ ˜
(var &optional [&rest var ]
(var init NIL [supplied-p] )
8 9∗
ˆ <var
ff =
&key var ˆ ˜
:( init NIL [supplied-p] );
(:key var )
ff∗
˜ˆ var ˜
[&allow-other-keys] &aux ).
(var [init NIL ])
16
Common Lisp Quick Reference
sO ff ff
flet foo \ ∗ )∗ [doc]
d
( sO (( (ord-λ∗ ) (declare local-decl
labels (setf foo)
P d ∗ )∗ formP∗ )
local-form ∗ )∗ ) (declare decl
⊲ Evaluate forms with locally defined functions foo. Glob-
ally defined functions of the same name are shadowed. Each
sO
foo is also the name of an implicit block around its corre-
∗ sO
sponding local-form . Only for labels, functions foo are
visible inside local-forms . Return values of form s.
ff
sO foo
(function M ∗ )
(lambda form )
⊲ Return lexically innermost function named foo or a lexi-
M
cal closure of the lambda expression.
ff
Fu function
(apply arg + )
(setf function)
⊲ Return values of function called on args. Last arg must
Fu Fu Fu
be a list. setfable if function is one of aref, bit, and sbit.
Fu
(funcall function arg∗ )
⊲ Return values of function called with arg s.
sO
(multiple-value-call foo form ∗ )
⊲ Call function foo with all the values of each form as its
arguments. Return values returned by foo .
Fu
(values-list list) ⊲ Return elements of list .
Fu
(values foo ∗ )
⊲ Return as multiple values the primary values of the foos.
setfable.
Fu
(multiple-value-list form)
⊲ Return in a list values of form.
M
(nth-value n form )
⊲ Zero-indexed nth return value of form.
Fu
(complement function)
⊲ Return new function with same arguments and same side
effects as function, but with complementary truth value.
Fu
(constantly foo)
⊲ Return function of any number of arguments returning
foo.
Fu
(identity foo) ⊲ Return foo.
Fu
(function-lambda-expression function)
⊲ If available, return lambda expression of function, NIL if
2
function was defined in an environment without bindings,
and name of function.
3
ff
Fu foo
(fdefinition )
(setf foo)
⊲ Definition of global function foo. setfable.
Fu
(fmakunbound foo)
⊲ Remove global function or macro definition foo.
co
call-arguments-limit
co
lambda-parameters-limit
⊲ Upper bound of the number of function arguments or
lambda list parameters, respectively; ≥ 50.
co
multiple-values-limit
⊲ Upper bound of the number of values a multiple value
can have; ≥ 20.
17
Common Lisp Quick Reference
9.4 Macros
Below, macro lambda ∗ ) has the form of either
list (macro-λff∗
var
([&whole var ] [E ] [E ]
(macro-λ∗ )
8 9∗
<var
ff =
[&optional var ˆ ˜ ] [E ]
:( init NIL [supplied-p] ) ;
(macro-λ∗ )
ff ff
&rest var
[ ] [E ]
&body (macro-λ∗ )
8 9∗
>
>var
8 9 >
>
ˆ < =
<var ff =ˆ ˜
&key [E ]
>(:(:key var
>
: );
init NIL [supplied-p] )> >
;
(macro-λ∗ )
ff∗
˜ var
[&allow-other-keys] [&aux ] [E ])
(var [init NIL ])
ff∗
var
or ([&whole var ] [E ] [E ]
(macro-λ∗ )
8 9∗
<var
ff =
[&optional var ˆ ˜ ] [E ] . var ).
:( init NIL [supplied-p] );
(macro-λ∗ )
18
Common Lisp Quick Reference
Fu
(get-setf-expansion place [environment NIL ])
⊲ Return lists of temporary variables arg-vars and of cor-
responding args as given with place, list newval-vars with
2 3
temporary variables corresponding to the new values, and
set-form and get-form specifying in terms of arg-vars and
4 5
newval-vars how to setf and how to read place.
M ˆ
(define-modify-macro foo ( &optional
ff∗
var ˆ ˜
˜ d
[&rest var ]) function [doc])
(var init NIL [supplied-p] )
⊲ Define macro foo able to modify a place. On invocation
of (foo place arg ∗ ), the value of function applied to place
and args will be stored into place and returned.
co
lambda-list-keywords
⊲ List of macro lambda list keywords. These are at least:
&whole var
⊲ Bind var to the entire macro call form.
&optional var ∗
⊲ Bind var s to corresponding arguments if any.
{&rest &body} var
⊲ Bind var to a list of remaining arguments.
&key var ∗
⊲ Bind var s to corresponding keyword arguments.
&allow-other-keys
⊲ Suppress keyword argument checking. Callers can do
so using :allow-other-keys T.
&environment var
⊲ Bind var to the lexical compilation environment.
sO
&aux var ∗ ⊲ Bind var s as in let∗.
19
Common Lisp Quick Reference
sO ff ˛ ff∗
let ˛name
( sO ( ˛˛ d ∗ )∗ formP∗ )
) (declare decl
let∗ (name [value NIL ])
⊲ Evaluate forms with names lexically bound (in parallel
or sequentially, respectively) to values. Return values of
forms.
M ff ˛ ff∗ ff
prog ˛var c ∗
d ∗ )∗ tag
( M ( ˛˛ ) (declare decl )
prog∗ (var [value NIL ]) form
sO
⊲ Evaluate tagbody-like body with var s locally bound (in
parallel or sequentially, respectively) to values. Return NIL
M
or explicitly returned values. Implicitly, the whole form is
sO
a block named NIL.
sO P
(progv symbols values form ∗ )
⊲ Evaluate forms with locally established dynamic bind-
ings of symbols to values or NIL. Return values of form s.
sO
(unwind-protect protected cleanup ∗ )
⊲ Evaluate protected and then, no matter how control
leaves protected , cleanups. Return values of protected .
M
d ∗ )∗ formP∗ )
(destructuring-bind destruct-λ bar (declare decl
⊲ Evaluate forms with variables from tree destruct-λ bound
to corresponding elements of tree bar , and return their
values. destruct-λ resembles macro-λ (section 9.4), but
without any &environment clause.
M
d ∗ )∗
var ∗ ) values-form (declare decl
(multiple-value-bind (d
P
body-form ∗ )
⊲ Evaluate body-forms with var s lexically bound to the re-
turn values of values-form. Return values of body-form s.
sO P
(block name form ∗ )
⊲ Evaluate forms in a lexical environment, and return their
sO
values unless interrupted by return-from.
sO
(return-from foo [result NIL ])
M
(return [result NIL ])
sO
⊲ Have nearest enclosing block named foo/named NIL, re-
spectively, return with values of result.
sO
c form}∗ )
(tagbody {tag
⊲ Evaluate forms in al lexical environment. tags (symbols
or integers) have lexical scope and dynamic extent, and are
sO
targets for go. Return NIL.
sO
c
(go tag)
sO
⊲ Within the innermost enclosing tagbody, jump to a tag
eql tag.
sO P
(catch tag form ∗ )
⊲ Evaluate forms and return their values unless interrupted
sO
by throw.
sO
(throw tag form)
sO
⊲ Have the nearest dynamically enclosing catch with a tag
Fu
eq tag return with the values of form.
Fu
(sleep n) ⊲ Wait n seconds, return NIL.
9.6 Iteration
M ff ff∗
do var ˆ d ∗ )∗
˜ ) (stop resultP∗ ) (declare decl
( M (
do∗ (var start [step] )
ff∗
c
tag
)
form
sO
⊲ Evaluate tagbody-like body with var s successively bound
according to the values of the corresponding start and step
forms. var s are bound in parallel/sequentially, respectively.
Stop iteration when stop is T. Return values of result ∗ .
sO
Implicitly, the whole form is a block named NIL.
M
d ∗ )∗ {tag
(dotimes (var i [result NIL ]) (declare decl c form}∗ )
sO
⊲ Evaluate tagbody-like body with var successively bound
to integers from 0 to i − 1. Upon evaluation of result , var
sO
is i. Implicitly, the whole form is a block named NIL.
20
Common Lisp Quick Reference
M
d ∗ )∗ {tag
(dolist (var list [result NIL ]) (declare decl c form}∗ )
sO
⊲ Evaluate tagbody-like body with var successively bound
to the elements of list. Upon evaluation of result , var is
sO
NIL. Implicitly, the whole form is a block named NIL.
21
8 ff 9∗
22
Overview.
> >
>ˆ upfrom ˜ ˆ ˜> >
> > > ; >
>
> >
> >
> >
> >
> >
> unless >
>
>
> >
> start 0 to form > > >
> >
> >
> >
>
>
> >
> from : ; >
> >
> >
> >
> form >
>
>
> >
> ff below >
> >
> >
> >
> return >
>
>
> >
> = >
> >
> >
> it 9 >
>
>
> >
> downto >
> >
> >
> >
>
>
> >
>from start form [by step 1 ] >
> >
> >
> collect[ing] = ff >
>
>
> >
> above 8 9 >
> >
> >
> >
> form >
>
>
> >
> >
> >
> >
> >
> append[ing] [into list] >
>
>
> >
> ˆ < downto = ˜ > > >
> >
> >
> ; it >
>
>
> >
> >
> >
> >
> >
> nconc[ing] >
>
>
> >downfrom start
> to form ; > >
> >
> >
> 9 >
>
>
> >
> : ; >
> >
> >
> count[ing] > >
>
>
> >
> ff above >
> >
> >
> > >
>
>
< ff ff >
> >
> >
= >
< sum[ming] > > >
=
<in list [by function ] = n o∗ >
= ff
(loop [named n NIL ] for var
∗ [d-type] on
#’cdr
and Fi > > maximize form )
>
>as (var ) > > > > [into num] [type] >
>
> > > > > maximizing> > it >
>
>
> >= foo [then bar foo ]
>
>
>
>
>
>
>
>
>
>
> > >
>
>
>
> >
>across vector >
> >
> >
> minimize > >
; >
>
>
> > ff ff > >
> >
> >
>
>
>
>
>
8
hash-key of
>
>
> >
> >
> minimizing C0 >
>
>
>
> >
> >
> hash [using (hash-value v )]>
> >
> >
> >
>
>
> >
> >
>hash-keys in >
> >
> >
> ff >
>
>
> >
> >
> ff ff >
> >
> >
> initially >
>
>
> >
> ff >
<hash-value of >
> >
> >
> form + >
>
>
> >
> the hash [using (hash-key k )]>
> >
> >
> finally >
>
>
> >
> being hash-values in >
> >
> >
> >
>
>
> >
> each > 9 >
> >
> >
> repeat num >
>
>
> >
> >
>symbol[s] =ˆ ff >
> >
> >
> 9 >
>
>
> >
> >
> of ˜>
> >
> >
> while > >
>
>
> >
> >
> present-symbol[s] package var >
> >
> >
> > >
>
>
> >
: : ; in ∗package∗ >
; >
> >
> until > = >
>
>
> external-symbol[s] F0 >
> >
> >
>
>
> >
> >
> always test >
>
>
> >
> > >
: ; >>
> never >
>
>
>
>
>
T1 >
> ; >
>
>
: thereis T2 >
;
Common Lisp Quick Reference
10 CLOS
10.1 Classes
Fu
(slot-exists-p foo bar ) ⊲ T if foo has a slot bar .
Fu
(slot-boundp instance slot) ⊲ T if slot in instance is bound.
M
(defclass foo (superclass ∗ standard-object )
8 9∗
> slot
>
> 8˛ ∗ 9> >
>
>
> > ˛ {:reader reader } ff > >
>
>
> >
> ˛ >
> >
>
>
> > ˛
>˛{:writer writer ∗ >
> >
>
>
> >
> } >
> >
>
>
> >
> ˛ (setf writer ) >
> >
>
>
> >
> ˛ ∗ >
> >
>
< >˛{:accessor accessor
> }ff >
> =
<˛ =
( ˛ :instance )
>
> (slot ˛ :allocation :instance )>
>
>
> >
> ˛ :class >
> >
>
>
> >
> ˛ >
> >
>
> >˛{:initarg :initarg-name}∗
> >>
> >
>
>
> >
> ˛ >
> >
>
>
> >
>˛˛ :initform form >
>> >
>
> >
> >
> >
>
>
: :˛˛:type type
> >
;> ;
8˛ :documentation slot-doc 9
<˛˛(:default-initargs {name value}∗ )=
˛(:documentation class-doc) )
:˛˛ ;
(:metaclass name standard-class )
⊲ Define, as a subclass of superclass es, class foo. In a new
instance i , a slot ’s value defaults to form unless set via
:initarg-name; it is readable via (reader i) or (accessor
i), and writeable via (writer i value) or (setf (accessor
i) value). With :allocation :class, slot is shared by all in-
stances of class foo.
23
Common Lisp Quick Reference
Fu ˆ ˜
(find-class symbol errorp T [environment ] )
⊲ Return class named symbol . setfable.
gF
(make-instance class {:initarg value}∗ other-keyarg ∗ )
⊲ Make new instance of class .
gF
(reinitialize-instance instance {:initarg value}∗ other-keyarg ∗ )
⊲ Change local slots of instance according to initargs.
Fu
(slot-value foo slot) ⊲ Return value of slot in foo . setfable.
Fu
(slot-makunbound instance slot )
⊲ Make slot in instance unbound.
M ff
d (d
with-slots ({slot d ∗)
var slot)}
( M d ∗ )∗
instance (declare decl
with-accessors ((d \ ) )
var accessor ∗
P∗
form )
⊲ Return values of form s after evaluating them in a lexical
environment with slots of instance visible as setfable slot s
or var s/with accessor s of instance visible as setfable var s.
gF
(class-name class)
gF ⊲ Get/set name of class .
((setf class-name) new-name class)
Fu
(class-of foo) ⊲ Class foo is a direct instance of.
gF
^ new-class {:initarg value}∗ other-keyarg ∗ )
(change-class instance
⊲ Change class of instance to new-class.
gF
(make-instances-obsolete class)
⊲ Update instances of class.
gF ff
initialize-instance (instance)
( gF
update-instance-for-different-class previous current
{:initarg value}∗ other-keyarg ∗ )
⊲ Its primary method sets slots on behalf of
gF gF gF
make-instance/of change-class by means of shared-initialize.
gF
(update-instance-for-redefined-class instances added-slots
discarded-slots property-list {:initarg value}∗
other-keyarg ∗ )
⊲ Its primary method sets slots on behalf of
gF gF
make-instances-obsolete by means of shared-initialize.
gF
(allocate-instance class {:initarg value}∗ other-keyarg ∗ )
⊲ Return uninitialized instance of class. Called by
gF
make-instance.
ff
gF slots
(shared-initialize instance {:initarg value}∗ other-keyarg ∗ )
T
⊲ Fill instance’s slots using initargs and :initform forms.
8 9
>
>setf >
>
< =
gF slot-boundp
(slot-missing class object slot [value])
>slot-makunbound>
>
: >
;
slot-value
⊲ Called in case of attempted access to missing slot . Its
primary method signals error.
gF
(slot-unbound class instance slot )
Fu
⊲ Called by slot-value in case of unbound slot . Its primary
method signals unbound-slot.
24
Common Lisp Quick Reference
8˛ 9
˛ required-var + )
>˛(:argument-precedence-order
>
> +
>
>
>
>
> ˛(declare (optimize arg ) ) ∗ >
>
>
> ˛ >
>
> ˛ \
<˛(:documentation string) >
=
˛(:generic-function-class class ) )
> ˛ standard-generic-function
>
>˛˛(:method-class class standard-method )
> >
>
>
> >
>
>
> ˛ ∗ >
>
>˛(:method-combination c-type standard c-arg )
: >
;
˛(:method defmethod-args)∗
⊲ Define generic function foo. defmethod-args resemble
M
those of defmethod. For c-type see section 10.3.
ff
Fu foo
(ensure-generic-function
(setf foo)
8˛ 9
> ˛:argument-precedence-order required-var + >
>˛˛:declare (optimize arg ∗ )+
> >
>
>
> >
>
>
> ˛ >
>
>
> ˛:documentation string >
>
<˛ =
˛:generic-function-class class
˛ )
>
> ˛:method-class class >
>
>˛
> ∗ >
>
>
> ˛:method-combination c-type c-arg >
>
>
> ˛ >
>
:˛˛:lambda-list lambda-list
> >
;
:environment environment
⊲ Define or modify generic function foo.
:generic-function-class and :lambda-list have to be compat-
ible with a pre-existing generic function or with existing
methods, respectively. Changes to :method-class do not
propagate to existing methods. For c-type see section 10.3.
8 9
ff > > :before > >
< =
M foo :after
(defmethod [ primary method ]
(setf foo) > > :around >
>
: ∗;
qualifier
8 9∗
<var ff= ˆ
( class &optional
:(spec-var );
(eql bar )
ff∗
var ˆ ˜ ˆ
˜ [&rest var ] &key
(var init [supplied-p] )
8 9∗
<var ff = ˜
var ˆ ˜ [&allow-other-keys]
:( init [supplied-p] );
(:key var )
ff∗ (˛˛ )
ˆ var ˜ ˛(declare decl d ∗ )∗ P
&aux ) ˛d form ∗ )
(var [init]) ˛doc
⊲ Define new method for generic function foo. spec-var s
specialize to either being of class or being eql bar , re-
spectively. On invocation, var s and spec-var s of the new
method act like parameters of a function with body form ∗ .
sO
forms are enclosed in an implicit block foo. Applicable
qualifier s depend on the method-combination type; see sec-
tion 10.3.
gF ff
add-method
( gF generic-function method )
remove-method
⊲ Add (if necessary) or remove (if any) method to/from
generic-function.
gF
(find-method generic-function qualifiers specializers [error T ])
⊲ Return suitable method, or signal error.
gF
(compute-applicable-methods generic-function args)
⊲ List of methods suitable for args, most specific first.
Fu
(call-next-method arg ∗ current args )
⊲ From within a method, call next method with args; re-
turn its values.
gF
(no-applicable-method generic-function arg ∗ )
⊲ Called on invocation of generic-function on args if there
is no applicable method. Default method signals error.
Fu ff
invalid-method-error method
( Fu control arg ∗ )
method-combination-error
⊲ Signal error on applicable method with invalid qualifiers,
or on method combination. For control and arg s see format,
p. 34.
gF
(no-next-method generic-function method arg ∗ )
⊲ Called on invocation of call-next-method when there is
no next method. Default method signals error.
25
Common Lisp Quick Reference
gF
(function-keywords method )
⊲ Return list of keyword parameters of method and T if
2
other keys are allowed.
gF
(method-qualifiers method ) ⊲ List of qualifiers of method .
26
Common Lisp Quick Reference
P
∗ d
[(:no-error (ord-λ ) (declare decl )∗ form ∗ )])
∗
27
Common Lisp Quick Reference
ff
M restart P
(with-simple-restart ( control arg ∗ ) form ∗ )
NIL
⊲ Return values of form s unless restart is called during
Fu
their evaluation. In this case, describe restart using format
control and args (see p. 34) and return NIL and T.
2
8˛ 9
> ˛:interactive arg-function >
<˛˛
> >
M report-function =
(restart-case form (foo (ord-λ∗ ) ˛˛:report
>
> string "foo" >
:˛˛ >
;
:test test-function T
d ∗ )∗ restart-form ∗ )∗ )
(declare decl
P
28
Common Lisp Quick Reference
T condition
warning style-warning
simple-condition† simple-warning
simple-condition
serious-condition
error
simple-condition† simple-error
parse-error; program-error; control-error
stream-error end-of-file
parse-error† reader-error
storage-condition
†
For supertypes of this type look for the instance without a † .
Fu
(type-error-datum condition)
Fu
(type-error-expected-type condition)
⊲ Object which caused condition of type type-error, or its
expected type, respectively.
Fu
(simple-condition-format-control condition)
Fu
(simple-condition-format-arguments condition )
Fu Fu
⊲ Return format control or list of format arguments, re-
spectively, of condition .
var
∗break-on-signals∗ NIL
⊲ Condition type debugger is to be invoked on.
var
∗debugger-hook∗ NIL
⊲ Function of condition and function itself. Called before
debugger.
12 Input/Output
12.1 Predicates
Fu
(streamp foo)
Fu
(pathnamep foo) ⊲ T if foo is of indicated type.
Fu
(readtablep foo)
Fu
(input-stream-p stream)
Fu
(output-stream-p stream)
Fu
(interactive-stream-p stream)
Fu
(open-stream-p stream)
⊲ Return T if stream is for input, for output, interactive, or
open, respectively.
Fu
(pathname-match-p path wildcard )
⊲ T if path matches wildcard .
Fu ˆ
(wild-pathname-p path {:host :device :directory :name :type
˜
:version NIL} )
⊲ Return T if indicated component in path is wildcard. (NIL
indicates any component.)
29
Common Lisp Quick Reference
12.2 Reader
Fu ff
y-or-n-p
( Fu [control arg ∗ ])
yes-or-no-p
⊲ Ask user a question and return T or NIL depending on
Fu
their answer. See p. 34, format, for control and args.
M P
(with-standard-io-syntax form ∗ )
⊲ Evaluate forms with standard behaviour of reader and
printer. Return values of form s.
Fu ff
read ˆ ˆ
( Fu ^ ∗standard-input∗
stream var eof-err T
read-preserving-whitespace
˜˜
[eof-val NIL [recursive NIL ]] )
⊲ Read printed representation of object.
Fu ˆ ˆ
(read-from-string
8˛ string eof-error T eof-val
9 NIL
˛
ˆ<˛:start start 0 =˜˜˜
˛:end end NIL )
:˛˛ ;
:preserve-whitespace bool NIL
⊲ Return object read from string and zero-indexed position
2
of next character.
Fu ˆ ˜
^ ∗standard-input∗
(read-delimited-list char stream var [recursive NIL ] )
⊲ Continue reading until encountering char . Return list of
objects read. Signal error if no char is found in stream.
Fu ˆ ˆ
^ ∗standard-input∗
(read-char stream var eof-err T [eof-val NIL
˜˜
[recursive NIL ]] )
⊲ Return next character from stream.
Fu ˆ ˆ
^ ∗standard-input∗
(read-char-no-hang stream var eof-error T [eof-val NIL
˜˜
[recursive NIL ]] )
⊲ Next character from stream or NIL if none is available.
Fu ˆ ˆ ˆ
(peek-char mode NIL stream^ ∗standard-input∗
var eof-error T [eof-val NIL
˜˜˜
[recursive NIL ]] )
⊲ Next, or if mode is T, next non-whitespace character,
or if mode is a character, next instance of it, from stream
without removing it there.
Fu
^ ∗standard-input∗
(unread-char character [stream var ])
Fu
⊲ Put last read-chared character back into stream; return
NIL.
Fu ˆ ˜
^ eof-err T [eof-val NIL ] )
(read-byte stream
⊲ Read next byte from binary stream.
Fu ˆ ˆ
^ ∗standard-input∗
(read-line stream var eof-err T [eof-val NIL
˜˜
[recursive NIL ]] )
⊲ Return a line of text from stream and T if line has been
2
ended by end of file.
Fu
^ stream
(read-sequence sequence ^ [:start start 0 ][:end end NIL ])
⊲ Replace elements of sequence between start and end with
elements from stream. Return index of sequence’s first un-
modified element.
Fu
(readtable-case readtable ) :upcase
⊲ Case sensitivity attribute (one of :upcase, :downcase,
:preserve, :invert) of readtable. setfable.
ˆ ˜
Fu
(copy-readtable from-readtable ∗readtable∗
var ^
[to-readtable NIL ] )
⊲ Return copy of from-readtable .
ˆ
Fu
^ ∗readtable∗
(set-syntax-from-char to-char from-char to-readtable var
˜
[from-readtable standard readtable ] )
⊲ Copy syntax of from-char to to-readtable. Return T.
var
∗readtable∗ ⊲ Current readtable.
var
∗read-base∗ 10 ⊲ Radix for reading integers and ratios.
var
∗read-default-float-format∗ single-float
⊲ Floating point format to use when not indicated in the
number read.
30
Common Lisp Quick Reference
var
∗read-suppress∗ NIL
⊲ If T, reader is syntactically more tolerant.
Fu ˆ ˜
(set-macro-character char function non-term-p NIL [rt e ∗readtable∗
var ] )
⊲ Make char a macro character associated with function.
Return T.
Fu
(get-macro-character char [rt ∗readtable∗
var ])
⊲ Reader macro function associated with char , and T if
2
char is a non-terminating macro character.
Fu ˆ
(make-dispatch-macro-character char non-term-p NIL
˜
[rt ∗readtable∗
var ] )
⊲ Make char a dispatching macro character. Return T.
Fu
(set-dispatch-macro-character char sub-char function
e ∗readtable∗
[rt var ])
⊲ Make function a dispatch function of char followed by
sub-char . Return T.
Fu
(get-dispatch-macro-character char sub-char [rt ∗readtable∗
var ])
⊲ Dispatch function associated with char followed by
sub-char .
#[n](foo ∗ )
⊲ Vector of some (or n) foos filled with last foo if necessary.
#[n]∗b ∗
⊲ Bit vector of some (or n) bs filled with last b if necessary.
#Pstring ⊲ A pathname.
31
Common Lisp Quick Reference
#+feature when-feature
#–feature unless-feature
⊲ Means when-feature if feature is T, means unless-feature
var
if feature is NIL. feature is a symbol from ∗features∗, or
∗
({and or} feature ), or (not feature).
var
∗features∗
⊲ List of symbols denoting implementation-dependent fea-
tures.
|c ∗ |; \c
⊲ Treat arbitrary character(s) c as alphabetic preserving
case.
12.4 Printer
8 Fu 9
>
>prin1 >
< Fu > =
print ^ ∗standard-output∗
( Fu foo [stream var ])
>
>pprint>
: Fu > ;
princ
Fu Fu
⊲ Print foo to stream readably, readably between a newline
Fu
and a space, readably after a newline, or human-readably
Fu Fu
without any extra characters, respectively. prin1, print and
Fu
princ return foo.
Fu
(prin1-to-string foo)
Fu
(princ-to-string foo)
Fu
⊲ Print foo to string readably or human-readably, respec-
tively.
gF
^
(print-object object stream)
⊲ Print object to stream. Called by the Lisp printer.
˛ ff
˛
M
^ ˛:type bool NIL
(print-unreadable-object (foo stream
P∗
˛:identity bool NIL ) form )
⊲ Enclosed in #< and >, print foo by means of forms to
stream. Return NIL.
Fu
^ ∗standard-output∗
(terpri [stream var ])
⊲ Output a newline to stream. Return NIL.
Fu
^ ∗standard-output∗
(fresh-line) [stream var ]
⊲ Output a newline to stream and return T unless stream
is already at the start of a line.
Fu
^ ∗standard-output∗
(write-char char [stream var ])
⊲ Output char to stream.
Fu ff ˛ ff
write-string ˆ ˆ ˛:start start 0 ˜˜
( Fu ^ ∗standard-output∗
string stream var ˛
˛:end end NIL )
write-line
⊲ Write string to stream without/with a trailing newline.
Fu
^
(write-byte byte stream) ⊲ Write byte to binary stream.
˛ ff
˛
Fu
^ ˛:start start 0 )
(write-sequence sequence stream ˛:end end NIL
⊲ Write elements of sequence to stream.
8˛ 9
> ˛:array bool >
>
>˛˛:base radix >
>
>
> >
>
>
> ˛ 8 >
>
>
> ˛ <:upcase >
>
>
> ˛ >
>
>˛:case :downcase
> >
>
>
>˛˛ : >
>
>
> :capitalize >
>
>
> ˛ >
>
>˛:circle bool
> >
>
>
> ˛ >
>
>
>˛˛ :escape bool >
>
>
> >
>
>
> ˛ :gensym bool >
>
Fu ff >˛
> >
>
<˛:length {int NIL} =
write ˛
( Fu foo ˛:level {int NIL} )
write-to-string >
> ˛ >
>
>
> ˛:lines {int NIL} >
>
>˛
> >
>
>
>˛˛:miser-width {int NIL} >
>
>
> >
>
>
> ˛ :pprint-dispatch dispatch-table >
>
>˛
> >
>
>
> ˛:pretty bool >
>
>
>˛˛ >
>
>
> :radix bool >
>
>
> ˛ >
>
>
> ˛:readably bool >
>
>˛
> >
>
>
> ˛ >
>
>
>˛˛ :right-margin {int NIL} >
>
>
:˛:stream stream >
^ ∗standard-output∗ ;
var
32
Common Lisp Quick Reference
33
Common Lisp Quick Reference
var
∗print-pretty∗ ⊲ If T, print pretty.
var
∗print-radix∗ NIL ⊲ If T, print rationals with a radix indicator.
var
∗print-readably∗ NIL
Fu
⊲ If T, print readably or signal error print-not-readable.
var
∗print-right-margin∗ NIL
⊲ Right margin width in ems while pretty-printing.
Fu ˆ
(set-pprint-dispatch type function priority 0
˜
[table ∗print-pprint-dispatch∗
var ] )
⊲ Install entry comprising function of arguments stream
and object to print; and priority as type into table. If
function is NIL, remove type from table. Return NIL.
Fu
(pprint-dispatch foo [table ∗print-pprint-dispatch∗
var ])
⊲ Return highest priority function associated with type of
foo and T if there was a matching type specifier in table.
2
Fu
(copy-pprint-dispatch [table ∗print-pprint-dispatch∗
var ])
⊲ Return copy of table or, if table is NIL, initial value of
var
∗print-pprint-dispatch∗.
var
∗print-pprint-dispatch∗ ⊲ Current pretty print dispatch table.
12.5 Format
M
\)
(formatter control
⊲ Return function of stream and a &rest argument applying
Fu
format to stream, control , and the &rest argument return-
ing NIL or any excess arguments.
Fu
(format {T NIL out-string out-stream} control arg ∗ )
⊲ Output string control which may contain ˜ directives
possibly taking some args. Alternatively, control can be
M
a function returned by formatter which is then applied to
∗
out-stream and arg . Output to out-string, out-stream or,
var
if first argument is T, to ∗standard-output∗. Return NIL. If
first argument is NIL, return formatted output.
ˆ ˆ ˆ ˜˜˜
˜[min-col 0 ] ,[col-inc 1 ] ,[min-pad 0 ] ,pad-char ’
[:][@]{A S}
⊲ Aesthetic/Standard. Print argument of any type for
consumption by humans/by the reader, respectively.
With :, print NIL as () rather than nil; with @, add
pad-char s on the left rather than on the right.
ˆ ˆ ˆ
[radix
˜ ˆ 10 ] ,[width] ,[pad-char
˜˜˜˜ ’ ] ,[comma-char ’, ]
,comma-interval 3 [:][@]R
⊲ Radix. (With one or more prefix arguments.)
Print argument as number; with :, group digits
comma-interval each; with @, always prepend a sign.
{˜R ˜:R ˜@R ˜@:R}
⊲ Roman. Take argument as number and print it as
English cardinal number, as English ordinal number, as
Roman numeral, or as old Roman numeral, respectively.
ˆ ˆ
˜[width]
ˆ
,[pad-char ’ ] ,[comma-char ’, ]
˜˜˜
,comma-interval 3 [:][@]{D B O X}
⊲ Decimal/Binary/Octal/Hexadecimal. Print integer ar-
gument as number. With : group digits comma-interval
each; with @, always prepend a sign.
ˆ ˆ ˆ
[width]
˜ ˆ ,[dec-digits] ,[shift 0 ] ,[overflow-char ]
˜˜˜˜
,pad-char ’ [@]F
⊲ Fixed-Format Floating-Point. With @, always pre-
pend a sign.
ˆ ˆ ˆ
[width]
˜ ˆ ,[int-digits] ,[exp-digits] ,[scale-factor 1 ]
ˆ ˆ ˜˜˜˜˜˜
,[overflow-char ] ,[pad-char ’ ] ,exp-char
[@]{E G}
⊲ Exponential/General Floating-Point. Print argument
as floating-point number with int-digits before decimal
point and exp-digits in the signed exponent. With ˜G,
choose either ˜E or ˜F. With @, always prepend a sign.
34
Common Lisp Quick Reference
ˆ ˆ ˆ ˜˜˜
˜[dec-digits 2 ] ,[int-digits 1 ] ,[width 0 ] ,pad-char ’
[:][@]$
⊲ Monetary Floating-Point. Print argument as fixed-
format floating-point number. With :, put sign before
any padding; with @, always prepend a sign.
{˜C ˜:C ˜@C ˜@:C}
⊲ Character. Print, spell out, print in #\ syntax, or
tell how to type, respectively, argument as (possibly
non-printing) character.
{˜(text ˜) ˜:(text ˜) ˜@(text ˜) ˜:@(text ˜)}
⊲ Case-Conversion. Convert text to lowercase, convert
first letter of each word to uppercase, capitalize first
word and convert the rest to lowercase, or convert to
uppercase, respectively.
{˜P ˜:P ˜@P ˜:@P}
⊲ Plural. If argument eql 1 print nothing, otherwise
print s; do the same for the previous argument; if ar-
gument eql 1 print y, otherwise print ies; do the same
for the previous argument, respectively.
˜[n 1 ]% ⊲ Newline. Print n newlines.
˜[n 1 ]&
⊲ Fresh-Line. Print n − 1 newlines if output stream is
at the beginning of a line, or n newlines otherwise.
{˜ ˜: ˜@ ˜:@ }
⊲ Conditional Newline. Print a newline like
pprint-newline with argument :linear, :fill, :miser,
or :mandatory, respectively.
˜[:][@]←֓
⊲ Ignored Newline. Ignore newline and following white-
space. With :, ignore only newline; with @, ignore only
following whitespace.
˜[n 1 ]| ⊲ Page. Print n page separators.
˜[n 1 ]˜ ⊲ Tilde. Print n tildes.
ˆ ˆ ˆ ˜˜˜
˜[min-col 0 ] ˆ ,[col-inc 1 ] ,[min-pad 0 ] ˜ ,pad-char ’
∗
[:][@]< nl-text ˜[spare 0 [,width]]:; {text ˜;} text ˜>
⊲ Justification. Justify text produced by texts in a field
of at least min-col columns. With :, right justify; with
@, left justify. If this would leave less than spare char-
acters on the current line, output nl-text first.
ˆ ˜
˜[:][@]< {prefix "" ˜;} {per-line-prefix ˜@;}
ˆ ˜
body ˜;suffix "" ˜:[@]>
⊲ Logical Block. Act like pprint-logical-block using body
M
as format control string on the elements of the list ar-
gument or, with @, on the remaining arguments, which
are extracted by pprint-pop. With :, prefix and suffix
default to ( and ). When closed by ˜:@>, spaces in
body are replaced with conditional newlines.
{˜[n 0 ]i ˜[n 0 ]:i}
⊲ Indent. Set indentation to n relative to leftmost/to
current position.
˜[c 1 ] [,i 1 ] [:][@]T
⊲ Tabulate. Move cursor forward to column number
c+ki, k ≥ 0 being as small as possible. With :, calculate
column numbers relative to the immediately enclosing
section. With @, move to column number c0 + c + ki
where c0 is the current position.
{˜[m 1 ]∗ ˜[m 1 ]:∗ ˜[n 0 ]@∗}
⊲ Go-To. Jump m arguments forward, or backward, or
to argument n.
˜[limit][:][@]{text ˜}
⊲ Iteration. text is used repeatedly, up to limit, as con-
trol string for the elements of the list argument or (with
@) for the remaining arguments. With : or :@, list ele-
ments or remaining arguments should be lists of which
a new one is used at each iteration step.
ˆ ˆ ˜˜
˜ x ,y [,z ] ˆ
⊲ Escape Upward. Leave immediately ˜< ˜>,
Fu
˜< ˜:>, ˜{ ˜}, ˜?, or the entire format operation.
With one to three prefixes, act only if x = 0, x = y, or
x ≤ y ≤ z, respectively.
∗
˜[i][:][@][[{text ˜;} text][˜:;default ]˜]
35
Common Lisp Quick Reference
12.6 Streams
8˛ 8 9 9
>˛ >
>:input > > >
>
>˛ < = >
>
>
>˛ :output >
>
>˛:direction
> :input >
>
>
>˛ >
>:io >
> >
>
>˛
>˛ : ; >
>
>
> :probe >
>
>
>˛ >
>
>
>˛:element-type type character >
>
>
>˛ 8 >
>
>˛
>˛ >:new-version >
>
>
> >
> >
>
>
>˛ >
>:error >
>
>
>˛ >
> >
>
<˛ >:rename
> =
Fu ˛ <
(open path ˛ :rename-and-delete )
>
>˛ :if-exists >
>
>˛
> >:overwrite
> >
>
>
>˛ >
> >
>
>˛
>˛ >
>:append >
>
>
> >
> >
>
>
>˛ >
::supersede >
>
>
>˛ NIL >
>
>˛
> 8 >
>
>
>˛ >
>
>
>˛ <:error >
>
>
>˛ :if-does-not exist :create >
>
>˛
> >
>
>
>˛ : >
>
>˛
:˛ NIL >
;
:external-format format :default
⊲ Open file-stream to path .
Fu
(make-concatenated-stream input-stream ∗ )
Fu
(make-broadcast-stream output-stream ∗ )
Fu
(make-two-way-stream input-stream-part output-stream-part )
Fu
(make-echo-stream from-input-stream to-output-stream)
Fu
(make-synonym-stream variable-bound-to-stream)
⊲ Return stream of indicated type.
Fu ˆ ˜
(make-string-input-stream string start 0 [end NIL ] )
⊲ Return a string-stream supplying the characters from
string.
Fu
(make-string-output-stream [:element-type type character ])
⊲ Return a string-stream accepting characters (available via
Fu
get-output-stream-string).
Fu
(concatenated-stream-streams concatenated-stream )
Fu
(broadcast-stream-streams broadcast-stream )
⊲ Return list of streams concatenated-stream still has to
read from/broadcast-stream is broadcasting to.
Fu
(two-way-stream-input-stream two-way-stream)
Fu
(two-way-stream-output-stream two-way-stream)
Fu
(echo-stream-input-stream echo-stream)
Fu
(echo-stream-output-stream echo-stream)
⊲ Return source stream or sink stream of two-way-stream/
echo-stream, respectively.
Fu
(synonym-stream-symbol synonym-stream)
⊲ Return symbol of synonym-stream.
36
Common Lisp Quick Reference
Fu
^
(get-output-stream-string string-stream)
⊲ Clear and return as a string characters on string-stream.
Fu
(listen [stream ∗standard-input∗
var ])
⊲ T if there is a character in input stream.
Fu
^ ∗standard-input∗
(clear-input [stream var ])
⊲ Clear input from stream, return NIL.
8 Fu 9
<clear-output
Fu
=
^ ∗standard-output∗
( force-output [stream var ])
: Fu ;
finish-output
⊲ End output to stream and return NIL immediately, after
initiating flushing of buffers, or after flushing of buffers,
respectively.
Fu
^ [:abort bool NIL ])
(close stream
⊲ Close stream. Return T if stream had been open. If :abort
is T, delete associated file.
M
^ (declare decl
(with-open-stream (foo stream) d ∗ )∗ formP∗ )
⊲ Evaluate forms with foo locally bound to stream. Return
values of form s.
8˛ 9
<˛˛:index index
]=
M
(with-input-from-string (foo string ˛˛:start start 0 ) (declare
:˛ ;
:end end NIL
d ∗ )∗ formP∗ )
decl
⊲ Evaluate forms with foo locally bound to input
string-stream from string. Return values of form s; store
next reading position into index .
M
(with-output-to-string (foo [s^ tring NIL ] [:element-type type character ])
d ∗ )∗ formP∗ )
(declare decl
⊲ Evaluate forms with foo locally bound to an output
string-stream. Append output to string and return values
of form s if string is given. Return string containing output
otherwise.
Fu
(stream-external-format stream)
⊲ External file format designator.
var
∗terminal-io∗ ⊲ Bidirectional stream to user terminal.
var
∗standard-input∗
var
∗standard-output∗
var
∗error-output∗
⊲ Standard input stream, standard output stream, or stan-
dard error output stream, respectively.
var
∗debug-io∗
var
∗query-io∗
⊲ Bidirectional streams for debugging and user interaction.
12.7 Files
8˛ 9
> ˛:host host >
>
> ˛ >
>
> ˛ >
>˛:device dev
>
>
>
>
>
>
> ˛ :directory dir >
>
> ˛
<˛:name name >
=
Fu
(make-pathname ˛˛:type type )
>
> ˛ >
>
>
> ˛ >
>
>
>
> ˛:version ver >
>
>
> ˛ >
>˛:defaults path
>
:
>
>
˛:case {:local :common} :local ;
⊲ Construct pathname.
Fu
(merge-pathnames
ˆ pathname
default-pathname ∗default-pathname-defaults∗
var
˜
[default-version :newest ] )
⊲ Return pathname after filling in missing parts from de-
faults.
var
∗default-pathname-defaults∗
⊲ Pathname to use if one is needed and none supplied.
Fu
(pathname path) ⊲ Pathname of path.
37
Common Lisp Quick Reference
Fu
(enough-namestring path [root-path ∗default-pathname-defaults∗
var ])
⊲ Return minimal path string to sufficiently describe path
relative to root-path.
Fu
(namestring path)
Fu
(file-namestring path)
Fu
(directory-namestring path)
Fu
(host-namestring path)
⊲ Return string representing full pathname; name, type,
and version; directory name; or host name, respectively, of
path.
Fu ˆ
(parse-namestring foo host
ˆ
default-pathname ∗default-pathname-defaults∗
var
8˛ 9
˛
<˛:start start 0 =˜˜
˛:end end NIL )
:˛˛ ;
:junk-allowed bool NIL
⊲ Return pathname converted from string, pathname, or
stream foo; and position where parsing stopped.
2
8 Fu 9
> pathname-host >
>
> Fu >
> ff
<pathname-device =
Fu :local
( pathname-directory path [:case ])
>
> Fu >
> :common :local
>pathname-name
: Fu
>
;
pathname-type
Fu
(pathname-version path)
⊲ Return pathname component.
Fu
(logical-pathname path) ⊲ Logical name of path.
Fu
(translate-pathname path-a path-b path-c)
⊲ Translate path-a from wildcard path-b into wildcard
path-c. Return new path.
Fu
(logical-pathname-translations host )
⊲ host ’s list of translations. setfable.
Fu
(load-logical-pathname-translations host )
⊲ Load host ’s translations. Return NIL if already loaded,
return T if successful.
Fu
(translate-logical-pathname path)
⊲ Physical pathname of path.
Fu
(probe-file file)
Fu
(truename file)
⊲ Canonical name of file. If file does not exist, return
NIL/signal file-error, respectively.
Fu
(file-write-date file) ⊲ Time at which file was last written.
Fu
(file-author file) ⊲ Return name of file owner.
Fu
(file-length stream) ⊲ Return length of stream .
8 9
Fu
<:start =
(file-position stream [ :end ])
: ;
position
⊲ Return position within stream, or set it to position and
return T on success.
Fu
(file-string-length stream foo)
⊲ Length foo would have in stream.
Fu
(rename-file foo bar )
⊲ Rename file foo to bar . Unspecified parts of path bar de-
fault to those of foo. Return new pathname, old file name,
2
and new file name.
3
Fu
(delete-file file) ⊲ Delete file, return T.
Fu
(directory path) ⊲ Return list of pathnames.
Fu
(ensure-directories-exist path [:verbose bool ])
⊲ Create parts of path if necessary. Second return value is
T if something has been created.
2
38
Common Lisp Quick Reference
M
d ∗ )∗ formP∗ )
(with-open-file (stream path open-arg ∗ ) (declare decl
Fu
⊲ Use open with open-arg s (cf. page 36) to temporarily
create stream to path; return values of form s.
Fu
(user-homedir-pathname [host ]) ⊲ User’s home directory.
sO
d form)
(the type
⊲ Return values of form which are declared to be of type.
Fu
(coerce object type) ⊲ Coerce object into type.
ff
ˆ ˜
M
d a-formP∗ )∗ ( otherwise b-form NILP∗ ) )
(typecase foo (type
T
⊲ Return values of the a-form s whose type is foo of. Return
values of b-form s if no type matches.
M ff
ctypecase d formP∗ )∗ )
( M foo (type
etypecase
⊲ Return values of the form s whose type is foo of. Sig-
nal correctable/non-correctable error, respectively if no type
matches.
Fu
(type-of foo) ⊲ Type of foo .
(eql foo)
⊲ Specifier for a type comprising foo or foos.
(member foo ∗ )
(satisfies predicate)
⊲ Type specifier for all objects satisfying predicate.
39
Common Lisp Quick Reference
ˆ ˜
T number real lower-limit ∗ [upper-limit ∗ ]
ˆ ˜
rational lower-limit ∗ [upper-limit ∗ ]
ˆ ˜
integer lower-limit ∗ [upper-limit ∗ ]
signed-byte [size ∗ ]
unsigned-byte [size ∗ ] bit
fixnum; bignum
ratio
ˆ ˜
float lower-limit ∗ [upper-limit ∗ ]
ˆ ˜
short-float ˆlower-limit ∗ [upper-limit ∗ ] ˜
single-float ˆlower-limit ∗ [upper-limit ∗ ] ˜
ˆ lower-limit ∗ [upper-limit˜∗ ]
double-float
long-float lower-limit ∗ [upper-limit ∗ ]
complex [type ∗ ]
ˆ ˜
sequence list cons car-type ∗ [cdr-type ∗ ]
symbol† null
ˆ ˜
array† type ∗ [rank ∗ (dimension ∗ )]
ˆ ˜
simple-array† type ∗ [rank ∗ (dimension ∗ )]
ˆ ˜
vector† type ∗ [size ∗ ]
bit-vector† [size ∗ ]
simple-bit-vector [size ∗ ]
string† [size ∗ ]
simple-string [size ∗ ]
base-string† [size ∗ ]
simple-base-string [size ∗ ]
simple-vector [size ∗ ]
ˆ ˜
vector type ∗ [size ∗ ]
string[size ∗ ] base-string[size ∗ ]
bit-vector[size ∗ ]
ˆ ˜
array type ∗ [rank ∗ (dimension ∗ )]
ˆ ˜
simple-array type ∗ [rank ∗ (dimension ∗ )]
pathname logical-pathname
method† standard-method
40
Common Lisp Quick Reference
14.2 Packages
:bar keyword:bar ⊲ Keyword, evaluates to :bar .
Fu
^
(delete-package package)
⊲ Delete package. Return T if successful.
var
∗package∗ common-lisp-user ⊲ The current package.
Fu
(list-all-packages) ⊲ List of registered packages.
Fu
(package-name package) ⊲ Name of package .
Fu
(package-nicknames package) ⊲ List of nicknames of package.
Fu
(find-package name)
⊲ Package object with name (case-sensitive).
Fu
(find-all-symbols name)
⊲ Return list of symbols with name from all registered
packages.
Fu ff
intern
( Fu foo [package ∗package∗
var ])
find-symbol
⊲ Intern or find, respectively, symbol foo in package. Sec-
ond return value is one of :internal, :external, or :inherited
Fu 2 2 2
(or NIL if intern created a fresh symbol).
2
Fu
(unintern symbol [package ∗package∗
var ])
⊲ Remove symbol from package, return T on success.
41
Common Lisp Quick Reference
Fu ff
import
( Fu symbols [package ∗package∗
var ])
shadowing-import
⊲ Make symbols internal to package. Return T. In case of
a name conflict signal correctable package-error or shadow
the old symbol, respectively.
Fu
(shadow symbols [package ∗package∗
var ])
⊲ Add symbols to shadowing list of package making equally
named inherited symbols shadowed. Return T.
Fu
(package-shadowing-symbols package)
⊲ List of shadowing symbols of package.
Fu
(export symbols [package ∗package∗
var ])
⊲ Make symbols external to package. Return T.
Fu
(unexport symbols [package ∗package∗
var ])
⊲ Revert symbols to internal status. Return T.
8M ff 9
<do-symbols ˆ ˜=
M (d
var package ∗package∗
var [result NIL ] )
( do-external-symbols
:M ;
do-all-symbols (var [result NIL ])
˛ ff
˛ c
d ∗ )∗ ˛tag
(declare decl ∗
˛form )
sO
⊲ Evaluate tagbody-like body with var successively bound
to every symbol from package, to every external symbol
from package, or to every symbol from all registered pack-
ages, respectively. Return values of result . Implicitly, the
sO
whole form is a block named NIL.
M
(with-package-iterator (foo packages [:internal :external :inherited])
d ∗ )∗ formP∗ )
(declare decl
⊲ Return values of form s. In forms, successive invocations
of (foo) return: T if a symbol is returned; a symbol from
packages; accessibility (:internal, :external, or :inherited);
and the package the symbol belongs to.
Fu
(require module [path-list NIL ])
var
⊲ If not in ∗modules∗, try paths in path-list to load module
from. Signal error if unsuccessful. Deprecated.
Fu
(provide module )
var
⊲ If not already there, add module to ∗modules∗. Depre-
cated.
var
∗modules∗ ⊲ List of names of loaded modules.
14.3 Symbols
A symbol has the attributes name, home package, property list, and
optionally value (of global constant or variable name) and function
(function, macro, or special operator name).
Fu
(make-symbol name)
⊲ Make fresh, uninterned symbol name.
Fu
(gensym [s G ])
⊲ Return fresh, uninterned symbol #:sn with n from
var var
∗gensym-counter∗. Increment ∗gensym-counter∗.
Fu ˆ ˜
(gentemp prefix T [package ∗package∗
var ] )
⊲ Intern fresh symbol in package. Deprecated.
Fu
(copy-symbol symbol [props NIL ])
⊲ Return uninterned copy of symbol . If props is T, give
copy the same value, function and property list.
Fu
(symbol-name symbol )
Fu
(symbol-package symbol )
Fu
(symbol-plist symbol )
Fu
(symbol-value symbol )
Fu
(symbol-function symbol )
⊲ Name, package, property list, value, or function, respec-
tively, of symbol . setfable.
gF ff
documentation
( gF foo {’variable ’function
(setf documentation) new-doc
’compiler-macro ’method-combination ’structure ’type ’setf
T})
⊲ Get/set documentation string of foo of given type.
42
Common Lisp Quick Reference
co
t
⊲ Truth; the supertype of every type including t; the su-
var
perclass of every class except t; ∗terminal-io∗.
co co
nil ()
⊲ Falsity; the empty list; the empty type, subtype of ev-
var var
ery type; ∗standard-input∗; ∗standard-output∗; the global
environment.
common-lisp-user cl-user
⊲ Current package after startup; uses package common-lisp.
keyword
⊲ Contains symbols which are defined to be of type
keyword.
15 Compiler
15.1 Predicates
Fu
(special-operator-p foo) ⊲ T if foo is a special operator.
Fu
(compiled-function-p foo)
⊲ T if foo is of type compiled-function.
15.2 Compilation
8 9
<NIL
definitionff =
Fu
(compile name )
: [definition];
(setf name)
⊲ Return compiled function or replace name’s function def-
inition with the compiled function. Return T in case of
2
warnings or errors, and T in case of warnings or errors ex-
3
cluding style warnings.
8˛ 9
> ˛:output-file out-path >
>
<˛˛:verbose bool var >
=
Fu
(compile-file file ˛˛ ∗compile-verbose∗
)
>
> :print bool var >
:˛˛ ∗compile-print∗ >
;
:external-format file-format :default
⊲ Write compiled contents of file to out-path. Return true
output path or NIL, T in case of warnings or errors, T in case
2 3
of warnings or errors excluding style warnings.
Fu
(compile-file-pathname file [:output-file path] [other-keyargs])
Fu
⊲ Pathname compile-file writes to if invoked with the same
arguments.
8˛ 9
> ˛:verbose bool var >
<˛˛:print bool var∗load-verbose∗
> >
=
Fu
(load path ˛ ˛ ∗load-print∗
)
>
> :if-does-not-exist bool >
:˛˛ T >
;
:external-format file-format :default
⊲ Load source file or compiled file into Lisp environment.
Return T if successful.
var ff
∗compile-file pathname∗ NIL
var -
∗load truename∗ NIL
Fu Fu
⊲ Input file used by compile-file/by load.
var ff
∗compile print∗
var -
∗load verbose∗
Fu Fu
⊲ Defaults used by compile-file/by load.
8˛ 9
<˛˛{:compile-toplevel compile}=
sO P
(eval-when ( ˛˛{:load-toplevel load} ) form ∗ )
:˛ ;
{:execute eval}
sO
⊲ Return values of form s if eval-when is in the top-level of a
file being compiled, in the top-level of a compiled file being
loaded, or anywhere, respectively. Return NIL if forms are
not evaluated. (compile, load and eval deprecated.)
43
Common Lisp Quick Reference
sO
d ∗ )∗ form ∗ )
(locally (declare decl
P
44
Common Lisp Quick Reference
ff∗
M function
(untrace )
(setf function)
⊲ Stop functions, or each currently traced function, from
being traced.
var
∗trace-output∗
M M
⊲ Stream trace and time print their output on.
M
(step form )
⊲ Step through evaluation of form. Return values of form .
Fu
(break [control arg ∗ ])
⊲ Jump directly into debugger; return NIL. See p. 34,
Fu
format, for control and arg s.
M
(time form)
⊲ Evaluate forms and print timing information to
var
∗trace-output∗. Return values of form .
Fu
(inspect foo) ⊲ Interactively give information about foo.
Fu
^ ∗standard-output∗
(describe foo [stream var ])
⊲ Send information about foo to stream.
gF
^
(describe-object foo [stream])
⊲ Send information about foo to stream. Not to be called
by user.
Fu
(disassemble function)
⊲ Send disassembled representation of function to
var
∗standard-output∗. Return NIL.
15.4 Declarations
Fu
(proclaim decl )
M
d ∗)
(declaim decl
⊲ Globally make declaration(s) decl . decl can be:
declaration, type, ftype, inline, notinline, optimize, or
special. See below.
d ∗)
(declare decl
⊲ Inside certain forms, locally make declarations decl ∗ .
decl can be: dynamic-extent, type, ftype, ignorable, ignore,
inline, notinline, optimize, or special. See below.
(declaration foo∗ )
⊲ Make foos names of declarations.
sO
(dynamic-extent variable ∗ (function function)∗ )
⊲ Declare lifetime of variables and/or functions to end
when control leaves enclosing block.
([type] type variable ∗ )
(ftype type function ∗ )
⊲ Declare variables or functions to be of type.
ff ff∗
ignorable var
( sO )
ignore (function function)
⊲ Suppress warnings about used/unused bindings.
(inline function ∗ )
(notinline function ∗ )
⊲ Tell compiler to integrate/not to integrate, respec-
tively, called functions into the calling routine.
8˛ 9
> ˛compilation-speed (compilation-speed n 3 )>
>˛
> >
>
>
<˛˛debug (debug n 3 ) >
=
˛
(optimize ˛safety (safety n 3 ) )
>
> ˛ >
>
>
>˛space (space n 3 ) >
>
: ˛speed (speed n ) ;
3
⊲ Tell compiler how to optimize. n = 0 means unim-
portant, n = 1 is neutral, n = 3 means important.
(special var ∗ ) ⊲ Declare var s to be dynamic.
45
Common Lisp Quick Reference
16 External Environment
Fu
(get-internal-real-time)
Fu
(get-internal-run-time)
⊲ Current time, or computing time, respectively, in clock
ticks.
co
internal-time-units-per-second
⊲ Number of clock ticks per second.
Fu
(encode-universal-time sec min hour date month year [zone curr ])
Fu
(get-universal-time)
⊲ Seconds from 1900-01-01, 00:00.
Fu
(decode-universal-time universal-time [time-zone current ])
Fu
(get-decoded-time)
⊲ Return second, minute, hour, date, month, year, day,
2 3 4 5 6 7
daylight-p, and zone.
8 9
Fu
(room [{NIL :default T}])
⊲ Print information about internal storage management.
Fu
(short-site-name)
Fu
(long-site-name)
⊲ String representing physical location of computer.
8 Fu 9
<lisp-implementation = ff
Fu type
( software - )
: Fu ; version
machine
⊲ Name or version of implementation, operating system, or
hardware, respectively.
Fu
(machine-instance) ⊲ Computer name.
46
Common Lisp Quick Reference
Index
” 31 &AUX 19 BIT-ANDC1 11 COMPILED-
’ 31 &BODY 19 BIT-ANDC2 11 FUNCTION-P 43
( 31 &ENVIRONMENT 19 BIT-EQV 11 COMPILER-MACRO 42
() 43 &KEY 19 BIT-IOR 11 COMPILER-MACRO-
∗ 40 &OPTIONAL 19 BIT-NAND 11 FUNCTION 44
∗ 3, 44 &REST 19 BIT-NOR 11 COMPLEMENT 17
∗∗ 44 &WHOLE 19 BIT-NOT 11 COMPLEX 4, 40
∗∗∗ 44 ∼( ∼) 35 BIT-ORC1 11 COMPLEXP 3
∗BREAK- ∼∗ 35 BIT-ORC2 11 COMPUTE-
ON-SIGNALS∗ 29 ∼/ / 36 BIT-VECTOR 40 APPLICABLE-
∗COMPILE-FILE- ∼< ∼:> 35 BIT-VECTOR-P 10 METHODS 25
PATHNAME∗ 43 ∼< ∼> 35 BIT-XOR 11 COMPUTE-RESTARTS
∗COMPILE-FILE- ∼? 36 BLOCK 20 28
TRUENAME∗ 43 ∼A 34 BOOLE 4 CONCATENATE 12
∗COMPILE-PRINT∗ 43 ∼B 34 BOOLE-1 4 CONCATENATED-
∗COMPILE- ∼C 35 BOOLE-2 4 STREAM 40
VERBOSE∗ 43 ∼D 34 BOOLE-AND 5 CONCATENATED-
∗DEBUG-IO∗ 37 ∼E 34 BOOLE-ANDC1 5 STREAM-STREAMS
∗DEBUGGER-HOOK∗ ∼F 34 BOOLE-ANDC2 5 36
29 ∼G 34 BOOLE-C1 4 COND 19
∗DEFAULT- ∼I 35 BOOLE-C2 4 CONDITION 29
PATHNAME- ∼O 34 BOOLE-CLR 4 CONJUGATE 4
DEFAULTS∗ 37 ∼P 35 BOOLE-EQV 5 CONS 8, 40
∗ERROR-OUTPUT∗ 37 ∼R 34 BOOLE-IOR 5 CONSP 8
∗FEATURES∗ 32 ∼S 34 BOOLE-NAND 5 CONSTANTLY 17
∗GENSYM- ∼T 35 BOOLE-NOR 5 CONSTANTP 15
COUNTER∗ 42 ∼W 36 BOOLE-ORC1 5 CONTINUE 28
∗LOAD-PATHNAME∗ ∼X 34 BOOLE-ORC2 5 CONTROL-ERROR 29
43 ∼[ ∼] 36 BOOLE-SET 4 COPY-ALIST 9
∗LOAD-PRINT∗ 43 ∼$ 35 BOOLE-XOR 5 COPY-LIST 9
∗LOAD-TRUENAME∗ ∼% 35 BOOLEAN 40 COPY-PPRINT-
43 ∼& 35 BOTH-CASE-P 6 DISPATCH 34
∗LOAD-VERBOSE∗ 43 ∼ˆ 35 BOUNDP 15 COPY-READTABLE 30
∗MACROEXPAND- ∼ 35 BREAK 45 COPY-SEQ 14
HOOK∗ 44 ∼| 35 BROADCAST- COPY-STRUCTURE 15
∗MODULES∗ 42 ∼{ ∼} 35 STREAM 40 COPY-SYMBOL 42
∗PACKAGE∗ 41 ∼∼ 35 BROADCAST- COPY-TREE 10
∗PRINT-ARRAY∗ 33 ` 31 STREAM-STREAMS COS 3
∗PRINT-BASE∗ 33 | | 32 36 COSH 3
∗PRINT-CASE∗ 33 1+ 3 BUILT-IN-CLASS 40 COUNT 12, 23
∗PRINT-CIRCLE∗ 33 1– 3 BUTLAST 9 COUNT-IF 12
∗PRINT-ESCAPE∗ 33 BY 21 COUNT-IF-NOT 12
∗PRINT-GENSYM∗ 33 BYTE 5 COUNTING 23
ABORT 28
∗PRINT-LENGTH∗ 33 BYTE-POSITION 5 CTYPECASE 39
ABOVE 21
∗PRINT-LEVEL∗ 33 BYTE-SIZE 5
ABS 4
∗PRINT-LINES∗ 33
ACONS 9
∗PRINT- DEBUG 45
ACOS 3 DECF 3
MISER-WIDTH∗ 33
ACOSH 4 CAAR 9
∗PRINT-PPRINT- DECLAIM 45
ACROSS 21 CADR 9 DECLARATION 45
DISPATCH∗ 34
ADD-METHOD 25 CALL-ARGUMENTS-
∗PRINT-PRETTY∗ 34 DECLARE 45
ADJOIN 9 LIMIT 17
∗PRINT-RADIX∗ 34 DECODE-FLOAT 6
ADJUST-ARRAY 10 CALL-METHOD 26
∗PRINT-READABLY∗ DECODE-UNIVERSAL-
ADJUSTABLE- CALL-NEXT-METHOD
34 TIME 46
ARRAY-P 10 25
∗PRINT-RIGHT- DEFCLASS 23
ALLOCATE-INSTANCE CAR 8
MARGIN∗ 34 DEFCONSTANT 16
24 CASE 19
∗QUERY-IO∗ 37 DEFGENERIC 24
ALPHA-CHAR-P 6 CATCH 20
∗RANDOM-STATE∗ 4 DEFINE-COMPILER-
ALPHANUMERICP 6 CCASE 19
∗READ-BASE∗ 30 MACRO 18
ALWAYS 23 CDAR 9
∗READ-DEFAULT- DEFINE-CONDITION
AND 19, 21, 26, 39 CDDR 9
FLOAT-FORMAT∗ 27
APPEND 9, 23, 26 CDR 8
30 DEFINE-METHOD-
APPENDING 23 CEILING 4
∗READ-EVAL∗ 31 COMBINATION 26
APPLY 17 CELL-ERROR 29
∗READ-SUPPRESS∗ 31 DEFINE-MODIFY-
APROPOS 44 CELL-ERROR-NAME
∗READTABLE∗ 30 MACRO 19
APROPOS-LIST 44 28
∗STANDARD-INPUT∗ DEFINE-SETF-
AREF 10 CERROR 27
37 EXPANDER 18
ARITHMETIC-ERROR CHANGE-CLASS 24
∗STANDARD- DEFINE-SYMBOL-
29 CHAR 8
OUTPUT∗ 37 MACRO 18
ARITHMETIC-ERROR- CHAR-CODE 7
∗TERMINAL-IO∗ 37 DEFMACRO 18
OPERANDS 28 CHAR-CODE-LIMIT 7
∗TRACE-OUTPUT∗ 45 DEFMETHOD 25
ARITHMETIC-ERROR- CHAR-DOWNCASE 7
+ 3, 26, 44 DEFPACKAGE 41
OPERATION 28 CHAR-EQUAL 6
++ 44 DEFPARAMETER 16
ARRAY 40 CHAR-GREATERP 7
+++ 44 DEFSETF 18
ARRAY-DIMENSION 11 CHAR-INT 7
, 31 DEFSTRUCT 15
ARRAY-DIMENSION- CHAR-LESSP 7
,. 31 DEFTYPE 39
LIMIT 11 CHAR-NAME 7
,@ 31 DEFUN 16
ARRAY-DIMENSIONS CHAR-NOT-EQUAL 6
– 3, 44 DEFVAR 16
11 CHAR-
/ 3, 44 DELETE 13
ARRAY- NOT-GREATERP 7
// 44 DELETE-DUPLICATES
DISPLACEMENT 11 CHAR-NOT-LESSP 7
/// 44 13
ARRAY- CHAR-UPCASE 7
/= 3 DELETE-FILE 38
ELEMENT-TYPE 39 CHAR/= 6
: 41 DELETE-IF 13
ARRAY-HAS- CHAR< 6
:: 41 DELETE-IF-NOT 13
FILL-POINTER-P 10 CHAR<= 6
:ALLOW- DELETE-PACKAGE 41
ARRAY-IN-BOUNDS-P CHAR= 6
OTHER-KEYS 19 DENOMINATOR 4
10 CHAR> 6
; 31 DEPOSIT-FIELD 5
ARRAY-RANK 11 CHAR>= 6
< 3 DESCRIBE 45
ARRAY-RANK-LIMIT CHARACTER 7, 40
<= 3 DESCRIBE-OBJECT 45
11 CHARACTERP 6
= 3, 21 DESTRUCTURING-
ARRAY-ROW- CHECK-TYPE 39
> 3 BIND 20
MAJOR-INDEX 11
>= 3 CIS 4 DIGIT-CHAR 7
ARRAY-TOTAL-SIZE
\ 32 CL 43 DIGIT-CHAR-P 6
11
# 36 CL-USER 43 DIRECTORY 38
ARRAY-TOTAL-
#\ 31 CLASS 40 DIRECTORY-
SIZE-LIMIT 11
#’ 31 CLASS-NAME 24 NAMESTRING 38
ARRAYP 10
#( 31 CLASS-OF 24 DISASSEMBLE 45
AS 21
#∗ 31 CLEAR-INPUT 37 DIVISION-BY-ZERO 29
ASH 5
#+ 32 CLEAR-OUTPUT 37 DO 20, 21
ASIN 3
#– 32 CLOSE 37 DO-ALL-SYMBOLS 42
ASINH 4
#. 31 CLRHASH 14 DO-EXTERNAL-
ASSERT 27
#: 31 CODE-CHAR 7 SYMBOLS 42
ASSOC 9
#< 31 COERCE 39 DO-SYMBOLS 42
ASSOC-IF 9
#= 31 COLLECT 23 DO∗ 20
ASSOC-IF-NOT 9
#A 31 COLLECTING 23 DOCUMENTATION 42
ATAN 3
#B 31 COMMON-LISP 43 DOING 21
ATANH 4
#C( 31 COMMON-LISP-USER DOLIST 21
ATOM 8, 40
#O 31 43 DOTIMES 20
#P 31 COMPILATION-SPEED DOUBLE-FLOAT 40
#R 31 BASE-CHAR 40 45 DOUBLE-
#S( 31 BASE-STRING 40 COMPILE 43 FLOAT-EPSILON 6
#X 31 BEING 21 COMPILE-FILE 43 DOUBLE-FLOAT-
## 31 BELOW 21 COMPILE-FILE- NEGATIVE-EPSILON
#| |# 31 BIGNUM 40 PATHNAME 43 6
&ALLOW- BIT 11, 40 COMPILED- DOWNFROM 21
OTHER-KEYS 19 BIT-AND 11 FUNCTION 40 DOWNTO 21
47
Common Lisp Quick Reference
48
Common Lisp Quick Reference
49
lc
Common Lisp Quick Reference Revision 105 [2009-09-03]
Copyright © 2008, 2009 Bert Burgemeister
LATEX source: http://clqr.berlios.de
Permission is granted to copy, distribute and/or modify this document under the
terms of the GNU Free Documentation License, Version 1.2 or any later version
published by the Free Software Foundation; with no Invariant Sections, no Front-
Cover Texts and no Back-Cover Texts. http://www.gnu.org/licenses/fdl.html