52
Quick Reference cl Common lisp Bert Burgemeister

Common Lisp Quick Reference - Cheat Sheets · Common Lisp Quick Reference Contents 1 Numbers 3 1.1 Predicates . . . . 3 1.2 Numeric Functns . 3 1.3 Logic Functions . 4 1.4 Integer

Embed Size (px)

Citation preview

Quick Reference

clCommon

lispBert Burgemeister

Common Lisp Quick Reference

Contents

1 Numbers 3

1.1 Predicates . . . . 31.2 Numeric Functns . 31.3 Logic Functions . 41.4 Integer Functions . 51.5 Implementation-

Dependent . . . . 6

2 Characters 6

3 Strings 7

4 Conses 8

4.1 Predicates . . . . 84.2 Lists . . . . . . 84.3 Association Lists . 94.4 Trees . . . . . . 104.5 Sets . . . . . . 10

5 Arrays 10

5.1 Predicates . . . . 105.2 Array Functions . 105.3 Vector Functions . 11

6 Sequences 12

6.1 Seq. Predicates . . 126.2 Seq. Functions . . 12

7 Hash Tables 14

8 Structures 15

9 Control Structure 15

9.1 Predicates . . . . 159.2 Variables . . . . 169.3 Functions . . . . 169.4 Macros . . . . . 18

9.5 Control Flow . . . 199.6 Iteration . . . . 209.7 Loop Facility . . . 21

10 CLOS 23

10.1 Classes . . . . . 2310.2 Generic Functns . 2410.3 Method Combi-

nation Types . . . 26

11 Conditions and Errors 27

12 Types and Classes 29

13 Input/Output 31

13.1 Predicates . . . . 3113.2 Reader . . . . . 3113.3 Character Syntax . 3213.4 Printer . . . . . 3313.5 Format . . . . . 3513.6 Streams . . . . . 3813.7 Paths and Files . . 39

14 Packages and Symbols 41

14.1 Predicates . . . . 4114.2 Packages . . . . 4114.3 Symbols . . . . . 4214.4 Std Packages . . 43

15 Compiler 43

15.1 Predicates . . . . 4315.2 Compilation . . . 4315.3 REPL & Debug . 4415.4 Declarations . . . 45

16 External Environment 46

Typographic Conventionsname;

Funame;

Mname;

sOname;

gFname;

var∗name∗;

coname

⊲ Symbol defined in Common Lisp; esp. function, macro,special operator, generic function, variable, constant.

them ⊲ Placeholder for actual code.

me ⊲ Literal text.

[foo bar ] ⊲ Either one foo or nothing; defaults to bar.

foo∗; {foo}∗ ⊲ Zero or more foos.

foo+; {foo}+ ⊲ One or more foos.

foos ⊲ English plural denotes a list argument.

{foo bar baz};

8<:foo

bar

baz

⊲ Either foo, or bar , or baz .

8<:

˛˛˛foo

bar

baz

⊲ Anything from none to each of foo, bar , and baz .

cfoo ⊲ Argument foo is not evaluated.

gbar ⊲ Argument bar is possibly modified.

fooP∗ ⊲ foo∗ is evaluated as in

sOprogn; see p. 19.

foo;2bar ;

n

baz ⊲ Primary, secondary, and nth return value.

T; NIL ⊲ t, or truth in general; and nil or ().

2

Common Lisp Quick Reference

1 Numbers

1.1 Predicates

(Fu= number+)

(Fu/= number+)

⊲ T if all numbers, or none, respectively, are equal in value.

(Fu> number+)

(Fu

>= number+)(Fu< number+)

(Fu

<= number+)⊲ Return T if numbers are monotonically decreasing,monotonically non-increasing, monotonically increasing, ormonotonically non-decreasing, respectively.

(Fuminusp a)

(Fuzerop a)

(Fuplusp a)

⊲ T if a < 0, a = 0, or a > 0, respectively.

(Fuevenp integer)

(Fuoddp integer)

⊲ T if integer is even or odd, respectively.

(Funumberp foo)

(Furealp foo)

(Furationalp foo)

(Fufloatp foo)

(Fuintegerp foo)

(Fucomplexp foo)

(Furandom-state-p foo)

⊲ T if foo is of indicated type.

1.2 Numeric Functions

(Fu+ a 0

∗)(Fu∗ a 1

∗)⊲ Return

Pa or

Qa, respectively.

(Fu– a b∗)

(Fu/ a b∗)

⊲ Return a−P

b or a/Q

b, respectively. Without any bs,return −a or 1/a, respectively.

(Fu1+ a)

(Fu1– a)

⊲ Return a + 1 or a− 1, respectively.

(

MincfMdecf

ffplace [delta 1 ])

⊲ Increment or decrement the value of place by delta. Re-turn new value.

(Fuexp p)

(Fuexpt b p)

⊲ Return ep or bp, respectively.

(Fulog a [b]) ⊲ Return logb a or, without b, ln a.

(Fusqrt n)

(Fuisqrt n)

⊲√

n in complex or natural numbers, respectively.

(Fulcm integer∗ 1 )

(Fugcd integer∗)

⊲ Least common multiple or greatest common denomina-tor, respectively, of integers. (gcd) returns 0.

copi ⊲ long-float approximation of π, Ludolph’s number.

(Fusin a)

(Fucos a)

(Futan a)

⊲ sin a, cos a, or tan a, respectively. (a in radians.)

(Fuasin a)

(Fuacos a)

⊲ arcsin a or arccos a, respectively, in radians.

(Fuatan a [b 1 ]) ⊲ arctan a

bin radians.

(Fusinh a)

(Fucosh a)

(Futanh a)

⊲ sinh a, cosh a, or tanh a, respectively.

3

Common Lisp Quick Reference

(Fuasinh a)

(Fuacosh a)

(Fuatanh a)

⊲ asinh a, acosh a, or atanh a, respectively.

(Fucis a) ⊲ Return ei a = cos a + i sina.

(Fuconjugate a) ⊲ Return complex conjugate of a.

(Fumax num+)

(Fumin num+)

⊲ Greatest or least, respectively, of nums.

(

8>><>>:

{ Furound

Fufround}

{ Fufloor

Fuffloor}

{ Fuceiling

Fufceiling}

{ Futruncate

Fuftruncate}

9>>=>>;

n [d 1 ])

⊲ Return as integer or float, respectively, n/d rounded, orrounded towards −∞, +∞, or 0, respectively; and

2remain-

der.

(

FumodFurem

ffn d)

⊲ Same asFufloor or

Futruncate, respectively, but return re-

mainder only.

(Furandom limit [state var

∗random-state∗ ])⊲ Return non-negative random number less than limit , andof the same type.

(Fumake-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.

(Fufloat-sign num-a [num-b 1 ]) ⊲ num-b with num-a’s sign.

(Fusignum n)

⊲ Number of magnitude 1 representing sign or phase of n .

(Funumerator rational)

(Fudenominator rational)

⊲ Numerator or denominator, respectively, of rational ’scanonical form.

(Furealpart number)

(Fuimagpart number)

⊲ Real part or imaginary part, respectively, of number .

(Fucomplex real [imag 0 ]) ⊲ Make a complex number.

(Fuphase number) ⊲ Angle of number ’s polar representation.

(Fuabs n) ⊲ Return |n|.

(Furational real)

(Furationalize real)

⊲ Convert real to rational. Assume complete/limited accu-racy for real .

(Fufloat real [prototype 0.0F0 ])

⊲ Convert real into float with type of prototype .

1.3 Logic Functions

Negative integers are used in two’s complement representation.

(Fuboole operation int-a int-b)

⊲ Return value of bitwise logical operation . operations are

coboole-1 ⊲ int-a.coboole-2 ⊲ int-b.coboole-c1 ⊲ ¬int-a.coboole-c2 ⊲ ¬int-b.coboole-set ⊲ All bits set.coboole-clr ⊲ All bits zero.coboole-eqv ⊲ int-a ≡ int-b.

4

Common Lisp Quick Reference

coboole-and ⊲ int-a ∧ int-b.coboole-andc1 ⊲ ¬int-a ∧ int-b.coboole-andc2 ⊲ int-a ∧ ¬int-b.coboole-nand ⊲ ¬(int-a ∧ int-b).coboole-ior ⊲ int-a ∨ int-b.coboole-orc1 ⊲ ¬int-a ∨ int-b.coboole-orc2 ⊲ int-a ∨ ¬int-b.coboole-xor ⊲ ¬(int-a ≡ int-b).coboole-nor ⊲ ¬(int-a ∨ int-b).

(Fulognot integer) ⊲ ¬integer .

(Fulogeqv integer∗)

(Fulogand integer∗)

⊲ Return value of exclusive-nored or anded integer s, re-spectively. Without any integer , return −1.

(Fulogandc1 int-a int-b) ⊲ ¬int-a ∧ int-b.

(Fulogandc2 int-a int-b) ⊲ int-a ∧ ¬int-b.

(Fulognand int-a int-b) ⊲ ¬(int-a ∧ int-b).

(Fulogxor integer∗)

(Fulogior integer∗)

⊲ Return value of exclusive-ored or ored integer s, respec-tively. Without any integer, return 0.

(Fulogorc1 int-a int-b) ⊲ ¬int-a ∨ int-b.

(Fulogorc2 int-a int-b) ⊲ int-a ∨ ¬int-b.

(Fulognor int-a int-b) ⊲ ¬(int-a ∨ int-b).

(Fulogbitp i integer)

⊲ T if zero-indexed ith bit of integer is set.

(Fulogtest int-a int-b)

⊲ Return T if there is any bit set in int-a which is set inint-b as well.

(Fulogcount int)

⊲ Number of 1 bits in int ≥ 0, number of 0 bits in int < 0.

1.4 Integer Functions

(Fuinteger-length integer)

⊲ Number of bits necessary to represent integer .

(Fuldb-test byte-spec integer)

⊲ Return T if any bit specified by byte-spec in integer is set.

(Fuash integer count)

⊲ Return copy of integer arithmetically shifted left bycount adding zeros at the right, or, for count < 0, shiftedright discarding bits.

(Fuldb byte-spec integer)

⊲ Extract byte denoted by byte-spec from integer . setfable.

(

Fudeposit-fieldFudpb

ffint-a byte-spec int-b)

⊲ Return int-b with bits denoted by byte-spec replacedby corresponding bits of int-a, or by the low (

Fubyte-size

byte-spec) bits of int-a, respectively.

(Fumask-field byte-spec integer)

⊲ Return copy of integer with all bits unset but those de-noted by byte-spec. setfable.

(Fubyte size position)

⊲ Byte specifier for a byte of size bits starting at a weightof 2position .

(Fubyte-size byte-spec)

(Fubyte-position byte-spec)

⊲ Size or position, respectively, of byte-spec.

5

Common Lisp Quick Reference

1.5 Implementation-Dependentcoshort-floatcosingle-floatcodouble-floatcolong-float

9>>=>>;

-

epsilonnegative-epsilon

⊲ Smallest possible number making a difference whenadded or subtracted, respectively.

coleast-negativecoleast-negative-normalizedcoleast-positivecoleast-positive-normalized

9>>=>>;

-

8>><>>:

short-floatsingle-floatdouble-floatlong-float

⊲ Available numbers closest to −0 or +0, respectively.

comost-negativecomost-positive

ff-

8>>><>>>:

short-floatsingle-floatdouble-floatlong-floatfixnum

⊲ Available numbers closest to −∞ or +∞, respectively.

(Fudecode-float n)

(Fuinteger-decode-float n)

⊲ Return significand,2exponent, and

3sign of float n.

(Fuscale-float n [i ]) ⊲ With n ’s radix b, return nbi.

(Fufloat-radix n)

(Fufloat-digits n)

(Fufloat-precision n)

⊲ Radix, number of digits in that radix, or precision in thatradix, respectively, of float n.

(Fuupgraded-complex-part-type foo [environment NIL ])

⊲ Type of most specialized complex number able to holdparts of type foo.

2 Characters

The standard-char type comprises a-z, A-Z, 0-9, Newline, Space, and!?$"’‘.:,;*+-/|\~ ^<=>#%@&()[]{}.

(Fucharacterp foo)

(Fustandard-char-p char)

⊲ T if argument is of indicated type.

(Fugraphic-char-p character)

(Fualpha-char-p character)

(Fualphanumericp character)

⊲ T if character is visible, alphabetic, or alphanumeric, re-spectively.

(Fuupper-case-p character)

(Fulower-case-p character)

(Fuboth-case-p character)

⊲ Return T if character is uppercase, lowercase, or able tobe in another case, respectively.

(Fudigit-char-p character [radix 10 ])

⊲ Return its weight if character is a digit, or NIL otherwise.

(Fuchar= character+)

(Fuchar/= character+)

⊲ Return T if all characters, or none, respectively, are equal.

(Fuchar-equal character+)

(Fuchar-not-equal character+)

⊲ Return T if all characters, or none, respectively, are equalignoring case.

(Fuchar> character+)

(Fuchar>= character+)

(Fuchar< character+)

(Fuchar<= character+)

⊲ Return T if characters are monotonically decreasing,monotonically non-increasing, monotonically increasing, ormonotonically non-decreasing, respectively.

6

Common Lisp Quick Reference

(Fuchar-greaterp character+)

(Fuchar-not-lessp character+)

(Fuchar-lessp character+)

(Fuchar-not-greaterp character+)

⊲ Return T if characters are monotonically decreasing,monotonically non-increasing, monotonically increasing, ormonotonically non-decreasing, respectively, ignoring case.

(Fuchar-upcase character)

(Fuchar-downcase character)

⊲ Return corresponding uppercase/lowercase character, re-spectively.

(Fudigit-char i [radix 10 ]) ⊲ Character representing digit i .

(Fuchar-name character) ⊲ character ’s name if any, or NIL.

(Funame-char foo) ⊲ Character named foo if any, or NIL.

(Fuchar-int character)

(Fuchar-code character)

⊲ Code of character .

(Fucode-char code) ⊲ Character with code .

cochar-code-limit ⊲ Upper bound of (

Fuchar-code char); ≥ 96.

(Fucharacter c) ⊲ Return #\c.

3 Strings

Strings can as well be manipulated by array and sequence functions;see pages 10 and 12.

(Fustringp foo)

(Fusimple-string-p foo)

⊲ T if foo is of indicated type.

(

Fustring=Fustring-equal

fffoo bar

8>><>>:

˛˛˛˛

:start1 start-foo 0

:start2 start-bar 0

:end1 end-foo NIL

:end2 end-bar NIL

9>>=>>;

)

⊲ Return T if subsequences of foo and bar are equal.Obey/ignore, respectively, case.

(

8>>>><>>>>:

Fustring{/= -not-equal}Fustring{> -greaterp}Fustring{>= -not-lessp}Fustring{< -lessp}Fustring{<= -not-greaterp}

9>>>>=>>>>;

foo bar

8>><>>:

˛˛˛˛

:start1 start-foo 0

:start2 start-bar 0

:end1 end-foo NIL

:end2 end-bar NIL

9>>=>>;

)

⊲ If foo is lexicographically not equal, greater, not less,less, or not greater, respectively, then return position offirst mismatching character in foo. Otherwise return NIL.Obey/ignore, respectively, case.

(Fumake-string size

˛:initial-element char

:element-type type character

ff)

⊲ Return string of length size.

(Fustring x)

(

8<:

Fustring-capitalizeFustring-upcaseFustring-downcase

9=; x

˛:start start 0:end end NIL

ff)

⊲ Convert x (symbol, string, or character) into a string, astring with capitalized words, an all-uppercase string, or anall-lowercase string, respectively.

(

8<:

Funstring-capitalizeFunstring-upcaseFunstring-downcase

9=; string

˛:start start 0:end end NIL

ff)

⊲ Convert string into a string with capitalized words, anall-uppercase string, or an all-lowercase string, respectively.

(

8<:

Fustring-trimFustring-left-trimFustring-right-trim

9=; char-bag string)

⊲ Return string with all characters in sequence char-bag

removed from both ends, from the beginning, or from theend, respectively.

7

Common Lisp Quick Reference

(Fuchar string i)

(Fuschar string i)

⊲ Return zero-indexed ith character of string ignor-ing/obeying, respectively, fill pointer. setfable.

(Fuparse-integer string

8>><>>:

˛˛˛˛

:start start 0:end end NIL

:radix int 10:junk-allowed bool NIL

9>>=>>;

)

⊲ Return integer parsed from string and2index of parse end.

4 Conses

4.1 Predicates

(Fuconsp foo)

(Fulistp foo)

⊲ Return T if foo is of indicated type.

(Fuendp list)

(Funull foo)

⊲ Return T if list/foo is NIL.

(Fuatom foo) ⊲ Return T if foo is not a cons.

(Futailp foo list) ⊲ Return T if foo is a tail of list .

(Fumember foo list

8<:

˛˛˛

:test function #’eql

:test-not function

:key function

9=;)

⊲ Return tail of list starting with its first element matchingfoo. Return NIL if there is no such element.

(

Fumember-ifFumember-if-not

fftest list [:key function ])

⊲ Return tail of list starting with its first element satisfyingtest . Return NIL if there is no such element.

(Fusubsetp list-a list-b

8<:

˛˛˛

:test function #’eql

:test-not function

:key function

9=;)

⊲ Return T if list-a is a subset of list-b.

4.2 Lists

(Fucons foo bar) ⊲ Return new cons (foo . bar ).

(Fulist foo∗) ⊲ Return list of foos.

(Fulist∗ foo+)

⊲ Return list of foos with last foo becoming cdr of last cons.Return foo if only one foo given.

(Fumake-list num [:initial-element foo NIL ])

⊲ New list with num elements set to foo.

(Fulist-length list) ⊲ Length of list ; NIL for circular list .

(Fucar list) ⊲ Car of list or NIL if list is NIL. setfable.

(Fucdr list)

(Furest list)

⊲ Cdr of list or NIL if list is NIL. setfable.

(Funthcdr n list) ⊲ Return tail of list after calling

Fucdr n times.

({ Fufirst

Fusecond

Futhird

Fufourth

Fufifth

Fusixth . . .

Funinth

Futenth} list)

⊲ Return nth element of list if any, or NIL otherwise.setfable.

(Funth n list) ⊲ Zero-indexed nth element of list . setfable.

(FucX r list)

⊲ With X being one to four as and ds representingFucars

andFucdrs, e.g. (

Fucadr bar) is equivalent to (

Fucar (

Fucdr bar)).

setfable.

(Fulast list [num 1 ]) ⊲ Return list of last num conses of list .

8

Common Lisp Quick Reference

(

Fubutlast listFunbutlast flist

ff[num 1 ]) ⊲ list excluding last num conses.

(

FurplacaFurplacd

ffgcons object)

⊲ Replace car, or cdr, respectively, of cons with object .

(Fuldiff list foo)

⊲ If foo is a tail of list , return preceding part of list . Oth-erwise return list .

(Fuadjoin foo list

8<:

˛˛˛

:test function #’eql

:test-not function

:key function

9=;)

⊲ Return list if foo is already member of list . If not, return(

Fucons foo list ).

(Mpop place) ⊲ Set place to (

Fucdr place), return (

Fucar place).

(Mpush foo place) ⊲ Set place to (

Fucons foo place ).

(Mpushnew foo place

8<:

˛˛˛

:test function #’eql

:test-not function

:key function

9=;)

⊲ Set place to (Fuadjoin foo place ).

(Fuappend [list∗ foo])

(Funconc [ flist∗ foo])

⊲ Return concatenated list. foo can be of any type.

(Furevappend list foo)

(Funreconc flist foo)

⊲ Return concatenated list after reversing order in list .

(

FumapcarFumaplist

fffunction list+)

⊲ Return list of return values of function successively in-voked with corresponding arguments, either cars or cdrs,respectively, from each list .

(

FumapcanFumapcon

fffunction list+)

⊲ Return list of concatenated return values of function suc-cessively invoked with corresponding arguments, either carsor cdrs, respectively, from each list . function should returna list.

(

FumapcFumapl

fffunction list+)

⊲ Return first list after successively applying function tocorresponding arguments, either cars or cdrs, respectively,from each list . function should have some side effects.

(Fucopy-list list) ⊲ Return copy of list with shared elements.

4.3 Association Lists

(Fupairlis keys values [alist NIL ])

⊲ Prepend to alist an association list made from lists keys

and values.

(Fuacons key value alist)

⊲ Return alist with a (key . value) pair added.

(

FuassocFurassoc

fffoo alist

8<:

˛˛˛

:test test #’eql

:test-not test

:key function

9=;)

(

Fuassoc-if[-not]Furassoc-if[-not]

fftest alist [:key function ])

⊲ First cons whose car, or cdr, respectively, satisfies test .

(Fucopy-alist alist) ⊲ Return copy of alist .

9

Common Lisp Quick Reference

4.4 Trees

(Futree-equal foo bar

:test test #’eql

:test-not test

ff)

⊲ Return T if trees foo and bar have same shape and leavessatisfying test.

(

Fusubst new old treeFunsubst new old gtree

ff 8<:

˛˛˛

:test function #’eql

:test-not function

:key function

9=;)

⊲ Make copy of tree with each subtree or leaf matching old

replaced by new .

(

Fusubst-if[-not] new test treeFunsubst-if[-not] new test gtree

ff[:key function])

⊲ Make copy of tree with each subtree or leaf satisfying test

replaced by new .

(

Fusublis association-list treeFunsublis association-list gtree

ff 8<:

˛˛˛

:test function #’eql

:test-not function

:key function

9=;)

⊲ Make copy of tree with each subtree or leaf matching akey in association-list replaced by that key’s value.

(Fucopy-tree tree) ⊲ Copy of tree with same shape and leaves.

4.5 Sets

(

8>>>>>>>>><>>>>>>>>>:

FuintersectionFuset-differenceFuunionFuset-exclusive-or

9>>=>>;

a b

FunintersectionFunset-difference

ffea b

FununionFunset-exclusive-or

ffea eb

9>>>>>>>>>=>>>>>>>>>;

8<:

˛˛˛

:test function #’eql

:test-not function

:key function

9=;)

⊲ Return a ∩ b, a \ b, a ∪ b, or a△ b, respectively, of lists a

and b.

5 Arrays

5.1 Predicates

(Fuarrayp foo)

(Fuvectorp foo)

(Fusimple-vector-p foo)

(Fubit-vector-p foo)

(Fusimple-bit-vector-p foo)

⊲ T if foo is of indicated type.

(Fuadjustable-array-p array)

(Fuarray-has-fill-pointer-p array)

⊲ T if array is adjustable/has a fill pointer, respectively.

(Fuarray-in-bounds-p array [subscripts])

⊲ Return T if subscripts are in array ’s bounds.

5.2 Array Functions

(

Fumake-array dimension-sizes

ˆ:adjustable bool NIL

˜Fuadjust-array array dimension-sizes

ff

8>>>><>>>>:

˛˛˛˛˛

:element-type type T

:fill-pointer {num bool}NIL8<:

:initial-element obj

:initial-contents sequence

:displaced-to array NIL [:displaced-index-offset i 0 ]

9>>>>=>>>>;

)

⊲ Return fresh, or readjust, respectively, vector or array.

(Fuaref array

ˆsubscripts

˜)

⊲ Return array element pointed to by subscripts. setfable.

(Furow-major-aref array i)

⊲ Return ith element of array in row-major order. setfable.

10

Common Lisp Quick Reference

(Fuarray-row-major-index array [subscripts])

⊲ Index in row-major order of the element denoted bysubscripts.

(Fuarray-dimensions array)

⊲ List containing the lengths of array ’s dimensions.

(Fuarray-dimension array i)

⊲ Length of ith dimension of array .

(Fuarray-total-size array) ⊲ Number of elements in array .

(Fuarray-rank array) ⊲ Number of dimensions of array .

(Fuarray-displacement array) ⊲ Target array and

2offset.

(Fubit bit-array [subscripts])

(Fusbit simple-bit-array [subscripts])

⊲ Return element of bit-array or of simple-bit-array. setf-able.

(Fubit-not ˜bit-array [ ˜result-bit-array NIL ])

⊲ Return result of bitwise negation of bit-array. Ifresult-bit-array is T, put result in bit-array ; if it is NIL,make a new array for result.

(

8>>>>>>>>>>>>><>>>>>>>>>>>>>:

Fubit-eqvFubit-andFubit-andc1Fubit-andc2Fubit-nandFubit-iorFubit-orc1Fubit-orc2Fubit-xorFubit-nor

9>>>>>>>>>>>>>=>>>>>>>>>>>>>;

˜bit-array-a bit-array-b [ ˜result-bit-array NIL ])

⊲ Return result of bitwise logical operations (cf. opera-tions of

Fuboole, 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.

coarray-rank-limit ⊲ Upper bound of array rank; ≥ 8.

coarray-dimension-limit

⊲ Upper bound of an array dimension; ≥ 1024.

coarray-total-size-limit ⊲ Upper bound of array size; ≥ 1024.

5.3 Vector Functions

Vectors can as well be manipulated by sequence functions; see sec-tion 6.

(Fuvector foo∗) ⊲ Return fresh simple vector of foo s.

(Fusvref vector i) ⊲ Return element i of simple vector . setfable.

(Fuvector-push foo vector)

⊲ Return NIL if vector ’s fill pointer equals size of vector .Otherwise replace element of vector pointed to by fillpointer with foo; then increment fill pointer.

(Fuvector-push-extend foo vector [num])

⊲ Replace element of vector pointed to by fill pointer withfoo, then increment fill pointer. Extend vector ’s size by≥ num if necessary.

(Fuvector-pop vector)

⊲ Return element of vector its fillpointer points to afterdecrementation.

(Fufill-pointer vector) ⊲ Fill pointer of vector . setfable.

11

Common Lisp Quick Reference

6 Sequences

6.1 Sequence Predicates

(

FueveryFunotevery

fftest sequence+)

⊲ Return NIL or T, respectively, as soon as test on any setof corresponding elements of sequences returns NIL.

(

FusomeFunotany

fftest sequence+)

⊲ Return value of test or NIL, respectively, as soon as test

on any set of corresponding elements of sequences returnsnon-NIL.

(Fumismatch sequence-a sequence-b

8>>>>>>>>>><>>>>>>>>>>:

˛˛˛˛˛˛˛˛

:from-end bool NIL:test function #’eql

:test-not function

:start1 start-a 0

:start2 start-b 0

:end1 end-a NIL

:end2 end-b NIL

:key function

9>>>>>>>>>>=>>>>>>>>>>;

)

⊲ Return position in sequence-a where sequence-a andsequence-b begin to mismatch. Return NIL if they matchentirely.

6.2 Sequence Functions

(Fumake-sequence sequence-type size [:initial-element foo])

⊲ Make sequence of sequence-type with size elements.

(Fuconcatenate type sequence∗)

⊲ Return concatenated sequence of type.

(Fumerge type ˜sequence-a ˜sequence-b test [:key function NIL ])

⊲ Return interleaved sequence of type. Merged sequencewill be sorted if both sequence-a and sequence-b are sorted.

(Fufill ˜sequence foo

˛:start start 0:end end NIL

ff)

⊲ Return sequence after setting elements between start andend to foo.

(Fulength sequence)

⊲ Return length of sequence (being value of fill pointer ifapplicable).

(Fucount foo sequence

8>>>>>><>>>>>>:

˛˛˛˛˛˛

:from-end bool NIL:test function #’eql

:test-not function

:start start 0:end end NIL

:key function

9>>>>>>=>>>>>>;

)

⊲ Return number of elements in sequence which match foo.

(

Fucount-ifFucount-if-not

fftest sequence

8>><>>:

˛˛˛˛

:from-end bool NIL:start start 0:end end NIL

:key function

9>>=>>;

)

⊲ Return number of elements in sequence which satisfy test.

(Fuelt sequence index)

⊲ Return element of sequence pointed to by zero-indexedindex . setfable.

(Fusubseq sequence start [end NIL ])

⊲ Return subsequence of sequence between start and end.setfable.

(

FusortFustable-sort

ff˜sequence test [:key function ])

⊲ Return sequence sorted. Order of elements consideredequal is not guaranteed/retained, respectively.

(Fureverse sequence)

(Funreverse ˜sequence)

⊲ Return sequence in reverse order.

12

Common Lisp Quick Reference

(

FufindFuposition

fffoo sequence

8>>>>>><>>>>>>:

˛˛˛˛˛˛

:from-end bool NIL:test function #’eql

:test-not test

:start start 0:end end NIL

:key function

9>>>>>>=>>>>>>;

)

⊲ Return first element in sequence which matches foo, orits position relative to the begin of sequence, respectively.

(

8>><>>:

Fufind-ifFufind-if-notFuposition-ifFuposition-if-not

9>>=>>;

test sequence

8>><>>:

˛˛˛˛

:from-end bool NIL:start start 0:end end NIL

:key function

9>>=>>;

)

⊲ Return first element in sequence which satisfies test , orits position relative to the begin of sequence, respectively.

(Fusearch sequence-a sequence-b

8>>>>>>>>>><>>>>>>>>>>:

˛˛˛˛˛˛˛˛

:from-end bool NIL:test function #’eql

:test-not function

:start1 start-a 0

:start2 start-b 0

:end1 end-a NIL

:end2 end-b NIL

:key function

9>>>>>>>>>>=>>>>>>>>>>;

)

⊲ Search sequence-b for a subsequence matchingsequence-a. Return position in sequence-b, or NIL.

(

Furemove foo sequenceFudelete foo ˜sequence

ff

8>>>>>>>><>>>>>>>>:

˛˛˛˛˛˛˛

:from-end bool NIL:test function #’eql

:test-not function

:start start 0:end end NIL

:key function

:count count NIL

9>>>>>>>>=>>>>>>>>;

)

⊲ Make copy of sequence without elements matching foo.

(

8>><>>:

Furemove-ifFuremove-if-not

fftest sequence

Fudelete-ifFudelete-if-not

fftest ˜sequence

9>>=>>;

8>>><>>>:

˛˛˛˛˛

:from-end bool NIL:start start 0:end end NIL

:key function

:count count NIL

9>>>=>>>;

)

⊲ Make copy of sequence with all (or count) elements sat-isfying test removed.

(

Furemove-duplicates sequenceFudelete-duplicates ˜sequence

ff

8>>>>>><>>>>>>:

˛˛˛˛˛˛

:from-end bool NIL:test function #’eql

:test-not function

:start start 0:end end NIL

:key function

9>>>>>>=>>>>>>;

)

⊲ Make copy of sequence without duplicates.

(

Fusubstitute new old sequenceFunsubstitute new old ˜sequence

ff

8>>>>>>>><>>>>>>>>:

˛˛˛˛˛˛˛

:from-end bool NIL:test function #’eql

:test-not function

:start start 0:end end NIL

:key function

:count count NIL

9>>>>>>>>=>>>>>>>>;

)

⊲ Make copy of sequence with all (or count) olds replacedby new .

(

8>><>>:

Fusubstitute-ifFusubstitute-if-not

ffnew test sequence

Funsubstitute-ifFunsubstitute-if-not

ffnew test ˜sequence

9>>=>>;

8>>><>>>:

˛˛˛˛˛

:from-end bool NIL:start start 0:end end NIL

:key function

:count count NIL

9>>>=>>>;

)

⊲ Make copy of sequence with all (or count) elements sat-isfying test replaced by new .

(Fureplace ˜sequence-a sequence-b

8>><>>:

˛˛˛˛

:start1 start-a 0

:start2 start-b 0

:end1 end-a NIL

:end2 end-b NIL

9>>=>>;

)

⊲ Replace elements of sequence-a with elements ofsequence-b.

13

Common Lisp Quick Reference

(Fumap type function sequence+)

⊲ Apply function successively to corresponding elements ofthe sequences. Return values as a sequence of type. If type

is NIL, return NIL.

(Fumap-into ˜result-sequence function sequence∗)

⊲ Store into result-sequence successively values of function

applied to corresponding elements of the sequences.

(Fureduce function sequence

8>>><>>>:

˛˛˛˛˛

:initial-value foo NIL

:from-end bool NIL:start start 0:end end NIL

:key function

9>>>=>>>;

)

⊲ Starting with the first two elements of sequence, applyfunction successively to its last return value together withthe next element of sequence. Return last value of function.

(Fucopy-seq sequence)

⊲ 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.

(Fuhash-table-p foo) ⊲ Return T if foo is of type hash-table.

(Fumake-hash-table

8>><>>:

˛˛˛˛

:test {Fueq

Fueql

Fuequal

Fuequalp}#’eql

:size int

:rehash-size num

:rehash-threshold num

9>>=>>;

)

⊲ Make a hash table.

(Fugethash key hash-table [default NIL ])

⊲ Return object with key if any or default otherwise; and

2T if found,

2NIL otherwise. setfable.

(Fuhash-table-count hash-table)

⊲ Number of entries in hash-table.

(Furemhash key ˜hash-table)

⊲ Remove from hash-table entry with key and return T if itexisted. Return NIL otherwise.

(Fuclrhash ˜hash-table) ⊲ Empty hash-table .

(Fumaphash function hash-table)

⊲ Iterate over hash-table calling function on key and value.Return NIL.

(Mwith-hash-table-iterator (foo hash-table) (declare ddecl∗)∗ form

P∗)⊲ Return values of forms. In forms, invocations of (foo)return: T if an entry is returned; its key; its value.

(Fuhash-table-test hash-table)

⊲ Test function used in hash-table.

(Fuhash-table-size hash-table)

(Fuhash-table-rehash-size hash-table)

(Fuhash-table-rehash-threshold hash-table)

⊲ Current size, rehash-size, or rehash-threshold, respec-tively, as used in

Fumake-hash-table.

(Fusxhash foo)

⊲ Hash code unique for any argumentFuequal foo.

14

Common Lisp Quick Reference

8 Structures

(Mdefstruct8

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>:

foo

(foo

8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>:

˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛

(:conc-name

(:conc-name [ slot-prefix foo- ])(:constructor

(:constructorˆmaker MAKE-foo [(ord-λ∗)]

˜)

)∗

(:copier

(:copier [copier COPY-foo ])

(:include struct

8><>:

dslot

(dslot [init

(˛˛:type sl-type

:read-only bb

)])

9>=>;

)

8>>>>><>>>>>:

(:type

8<:

listvector

(vector dtype)

9=;)

˛:named(:initial-offset bn)

((:print-object [ o-printer ])

(:print-function [ f-printer]):predicate(:predicate [p-name foo-P ])

9>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;

)

9>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;

[ddoc]

8><>:

slot

(slot [init

(˛˛:type slot-type

:read-only dbool

)])

9>=>;

)

⊲ Define structure foo together with functions MAKE-foo,COPY-foo and foo-P; and setfable accessors foo-slot . In-stances are of class foo or, if defstruct option :type is given,of the specified type. They 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, args and :keyscorrespond to the positional and keyword parameters de-fined in ord-λ whose vars in turn correspond to slots.:print-object/:print-function generate a

gFprint-object method

for an instance bar of foo calling (o-printer bar stream)or (f-printer bar stream print-level), respectively. If :typewithout :named is given, no foo-P is created.

(Fucopy-structure structure)

⊲ Return copy of structure with shared slot values.

9 Control Structure

9.1 Predicates

(Fueq foo bar) ⊲ T if foo and bar are identical.

(Fueql foo bar)

⊲ T if foo and bar are identical, or the same character, ornumbers of the same type and value.

(Fuequal foo bar)

⊲ T if foo and bar areFueql, or are equivalent pathnames,

or are conses withFuequal cars and cdrs, or are strings or

bit-vectors withFueql elements below their fill pointers.

(Fuequalp foo bar)

⊲ T if foo and bar are identical; or are the same characterignoring case; or are numbers of the same value ignoringtype; or are equivalent pathnames; or are conses or arraysof the same shape with

Fuequalp elements; or are structures

of the same type withFuequalp elements; or are hash-tables of

the same size with the same :test function, the same keysin terms of :test function, and

Fuequalp elements.

(Funot foo) ⊲ T if foo is NIL; NIL otherwise.

(Fuboundp symbol) ⊲ T if symbol is a special variable.

(Fuconstantp foo [environment NIL ])

⊲ T if foo is a constant form.

(Fufunctionp foo) ⊲ T if foo is of type function.

15

Common Lisp Quick Reference

(Fufboundp

foo

(setf foo)

ff) ⊲ T if foo is a global function or macro.

9.2 Variables

(

MdefconstantMdefparameter

ffcfoo form [ddoc])

⊲ Assign value of form to global constant/dynamic variablefoo.

(Mdefvar cfoo

ˆform [ddoc]

˜)

⊲ Unless bound already, assign value of form to dynamicvariable foo.

(

MsetfMpsetf

ff{place form}∗)

⊲ Set places to primary values of forms. Return values oflast form/NIL; work sequentially/in parallel, respectively.

(

sOsetqMpsetq

ff{symbol form}∗)

⊲ Set symbols to primary values of forms. Return value oflast form/NIL; work sequentially/in parallel, respectively.

(Fuset symbol foo)

⊲ Set symbol ’s value cell to foo. Deprecated.

(Mmultiple-value-setq vars form)

⊲ Set elements of vars to the values of form. Return form ’sprimary value.

(Mshiftf place+ foo)

⊲ Store value of foo in rightmost place shifting values ofplaces left, returning first place .

(Mrotatef place∗)

⊲ Rotate values of places left, old first becoming new lastplace ’s value. Return NIL.

(Fumakunbound ffoo) ⊲ Delete special variable foo if any.

(Fuget symbol key

ˆdefault NIL

˜)

(Fugetf place key

ˆdefault NIL

˜)

⊲ First entry key from property list stored in symbol/inplace , respectively, or default if there is no key. setfable.

(Fuget-properties property-list keys)

⊲ Return key and2value of first entry from property-list

matching a key from keys, and3tail of property-list start-

ing with that key. Return NIL,2NIL, and

3NIL if there was no

matching key in property-list .

(Furemprop symbol key)

(Mremf place key)

⊲ Remove first entry key from property list stored insymbol/in place , respectively. Return T if key was there,or NIL otherwise.

9.3 Functions

Below, ordinary lambda list (ord-λ∗) has the form

(var∗ˆ&optional

var

(varˆinit NIL [supplied-p]

˜)

ff∗˜[&rest var ]

ˆ&key

8<:var

(

var

(:key var)

ff ˆinit NIL [supplied-p]

˜)

9=;

[&allow-other-keys]˜ ˆ

&aux

var

(var [init NIL ])

ff∗˜).

supplied-p is T if there is a corresponding argument. init forms canrefer to any init and supplied-p to their left.

16

Common Lisp Quick Reference

(

8<:

Mdefun

foo (ord-λ∗)(setf foo) (new-value ord-λ∗)

Mlambda (ord-λ∗)

9=; (declare ddecl∗)∗ [ddoc]

formP∗)

⊲ Define a function named foo or (setf foo), or an anony-mous function, respectively, which applies forms to ord-λs.For

Mdefun, forms are enclosed in an implicit

sOblock named

foo.

(

sOfletsOlabels

ff((

foo (ord-λ∗)(setf foo) (new-value ord-λ∗)

ff(declare local-decl∗)∗

[ddoc] local-formP∗)∗) (declare ddecl∗)∗ form

P∗)⊲ Evaluate forms with locally defined functions foo. Glob-ally defined functions of the same name are shadowed. Eachfoo is also the name of an implicit

sOblock around its corre-

sponding local-form∗. Only forsOlabels, functions foo are

visible inside local-forms . Return values of forms.

(sOfunction

foo

(Mlambda form∗)

ff)

⊲ Return lexically innermost function named foo or a lexi-cal closure of the

Mlambda expression.

(Fuapply

function

(setf function)

ffarg∗ args)

⊲ Values of function called with args and the list elementsof args. setfable if function is one of

Fuaref,

Fubit, and

Fusbit.

(Fufuncall function arg∗) ⊲ Values of function called with args.

(sOmultiple-value-call function form∗)

⊲ Call function with all the values of each form as its ar-guments. Return values returned by function .

(Fuvalues-list list) ⊲ Return elements of list .

(Fuvalues foo∗)

⊲ Return as multiple values the primary values of the foos.setfable.

(Fumultiple-value-list form) ⊲ List of the values of form .

(Mnth-value n form)

⊲ Zero-indexed nth return value of form.

(Fucomplement function)

⊲ Return new function with same arguments and same sideeffects as function , but with complementary truth value.

(Fuconstantly foo)

⊲ Function of any number of arguments returning foo.

(Fuidentity foo) ⊲ Return foo.

(Fufunction-lambda-expression function)

⊲ If available, return lambda expression of function ,2NIL if

function was defined in an environment without bindings,and

3name of function .

(Fufdefinition

foo

(setf foo)

ff)

⊲ Definition of global function foo. setfable.

(Fufmakunbound foo)

⊲ Remove global function or macro definition foo.

cocall-arguments-limitcolambda-parameters-limit

⊲ Upper bound of the number of function arguments orlambda list parameters, respectively; ≥ 50.

comultiple-values-limit

⊲ Upper bound of the number of values a multiple valuecan have; ≥ 20.

17

Common Lisp Quick Reference

9.4 Macros

Below, macro lambda list (macro-λ∗) has the form of either

([&whole var ] [E ]

var

(macro-λ∗)

ff∗[E ]

[&optional

8<:var

(

var

(macro-λ∗)

ff ˆinit NIL [supplied-p]

˜)

9=;

] [E ]

[

&rest&body

ff rest-var

(macro-λ∗)

ff] [E ]

ˆ&key

8>><>>:

var

(

8<:

var

(:key

var

(macro-λ∗)

ff)

9=;

ˆinit NIL [supplied-p]

˜)

9>>=>>;

[E ]

[&allow-other-keys]˜

[&aux

var

(var [init NIL ])

ff∗] [E ])

or

([&whole var ] [E ]

var

(macro-λ∗)

ff∗[E ] [&optional

8<:var

(

var

(macro-λ∗)

ff ˆinit NIL [supplied-p]

˜)

9=;

] [E ] . rest-var).

One toplevel [E ] may be replaced by &environment var . supplied-p

is T if there is a corresponding argument. init forms can refer toany init and supplied-p to their left.

(

MdefmacroFudefine-compiler-macro

ff foo

(setf foo)

ff(macro-λ∗) (declare

ddecl∗)∗ [ddoc] formP∗)

⊲ Define macro foo which on evaluation as (foo tree) appliesexpanded forms to arguments from tree, which correspondsto tree-shaped macro-λs. forms are enclosed in an implicitsOblock named foo.

(Mdefine-symbol-macro foo form)

⊲ Define symbol macro foo which on evaluation evaluatesexpanded form.

(sOmacrolet ((foo (macro-λ∗) (declare local-decl∗)∗ [ddoc]

macro-formP∗)∗) (declare ddecl∗)∗ form

P∗)⊲ Evaluate forms with locally defined mutually invisiblemacros foo which are enclosed in implicit

sOblocks of the same

name.

(sOsymbol-macrolet ((foo expansion-form)∗) (declare ddecl∗)∗ form

P∗)⊲ Evaluate forms with locally defined symbol macros foo.

(Mdefsetf function(

updater [ddoc]

(setf-λ∗) (s-var∗) (declare ddecl∗)∗ [ddoc] formP∗

))

where defsetf lambda list (setf-λ∗) has the form (var∗

ˆ&optional

var

(varˆinit NIL [supplied-p]

˜)

ff∗˜[&rest var ]

ˆ&key

8<:var

(

var

(:key var)

ff ˆinit NIL [supplied-p]

˜)

9=;

[&allow-other-keys]˜ ˆ

&environment var˜)

⊲ Specify how to setf a place accessed by function .Short form: (setf (function arg∗) value-form) is replacedby (updater arg∗ value-form); the latter must returnvalue-form. Long form: on invocation of (setf (function

arg∗) value-form), forms must expand into code that setsthe place accessed where setf-λ and s-var∗ describe the ar-guments of function and the value(s) to be stored, respec-tively; and that returns the value(s) of s-var∗. forms areenclosed in an implicit

sOblock named function .

(Mdefine-setf-expander function (macro-λ∗) (declare ddecl∗)∗ [ddoc]

formP∗)

⊲ Specify how to setf a place accessed by function . On in-vocation of (setf (function arg∗) value-form), form∗ mustexpand into code returning arg-vars, args, newval-vars,set-form, and get-form as described with

Fuget-setf-expansion

where the elements of macro lambda list macro-λ∗ arebound to corresponding args. forms are enclosed in an im-plicit

sOblock named function.

18

Common Lisp Quick Reference

(Fuget-setf-expansion place [environment NIL ])

⊲ Return lists of temporary variables arg-vars and of cor-responding

2args as given with place , list

3newval-vars with

temporary variables corresponding to the new values, and

4set-form and

5get-form specifying in terms of arg-vars and

newval-vars how to setf and how to read place .

(Mdefine-modify-macro foo (

ˆ&optional

var

(varˆinit NIL [supplied-p]

˜)

ff∗˜[&rest var ]) function [ddoc])

⊲ Define macro foo able to modify a place. On invocationof (foo place arg∗), the value of function applied to place

and args will be stored into place and returned.

colambda-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 vars to corresponding arguments if any.

{&rest &body} var

⊲ Bind var to a list of remaining arguments.

&key var∗

⊲ Bind vars to corresponding keyword arguments.

&allow-other-keys⊲ Suppress keyword argument checking. Callers can doso using :allow-other-keys T.

&environment var

⊲ Bind var to the lexical compilation environment.

&aux var∗ ⊲ Bind vars as insOlet∗.

9.5 Control Flow

(sOif test then [else NIL ])

⊲ Return values of then if test returns T; return values ofelse otherwise.

(Mcond (test then

P∗test )

∗)⊲ Return the values of the first then∗ whose test returns T;return NIL if all tests return NIL.

(

MwhenMunless

fftest foo

P∗)

⊲ Evaluate foos and return their values if test returns T orNIL, respectively. Return NIL otherwise.

(Mcase test (

((dkey∗)dkey

)foo

P∗)∗ˆ(

otherwiseT

ffbar

P∗)NIL˜)

⊲ Return the values of the first foo∗ one of whose keys iseql test . Return values of bar s if there is no matching key.

(

MecaseMccase

fftest (

((dkey∗)dkey

)foo

P∗)∗)

⊲ Return the values of the first foo∗ one of whose keys iseql test. Signal non-correctable/correctable type-error andreturn NIL if there is no matching key.

(Mand form∗

T )⊲ Evaluate forms from left to right. Immediately returnNIL if one form’s value is NIL. Return values of last form

otherwise.

(Mor form∗

NIL )⊲ Evaluate forms from left to right. Immediately returnprimary value of first non-NIL-evaluating form, or all valuesif last form is reached. Return NIL if no form returns T.

(sOprogn form∗

NIL )⊲ Evaluate forms sequentially. Return values of last form .

(sOmultiple-value-prog1 form-r form∗)

(Mprog1 form-r form∗)

(Mprog2 form-a form-r form∗)

⊲ Evaluate forms in order. Return values/primary value,respectively, of form-r .

19

Common Lisp Quick Reference

(

sOletsOlet∗

ff(

˛name

(name [value NIL ])

ff∗) (declare ddecl∗)∗ form

P∗)

⊲ Evaluate forms with names lexically bound (in parallelor sequentially, respectively) to values. Return values offorms.

(

MprogMprog∗

ff(

˛name

(name [value NIL ])

ff∗) (declare ddecl∗)∗

ctagform

ff∗)

⊲ EvaluatesOtagbody-like body with names lexically bound

(in parallel or sequentially, respectively) to values. ReturnNIL or explicitly

Mreturned values. Implicitly, the whole form

is asOblock named NIL.

(sOprogv symbols values form

P∗)⊲ Evaluate forms with locally established dynamic bind-ings of symbols to values or NIL. Return values of forms.

(sOunwind-protect protected cleanup∗)

⊲ Evaluate protected and then, no matter how controlleaves protected , cleanups. Return values of protected .

(Mdestructuring-bind destruct-λ bar (declare ddecl∗)∗ form

P∗)⊲ Evaluate forms with variables from tree destruct-λ boundto corresponding elements of tree bar , and return theirvalues. destruct-λ resembles macro-λ (section 9.4), butwithout any &environment clause.

(Mmultiple-value-bind (dvar∗) values-form (declare ddecl∗)∗

body-formP∗)

⊲ Evaluate body-forms with vars lexically bound to the re-turn values of values-form. Return values of body-form s.

(sOblock name form

P∗)⊲ Evaluate forms in a lexical environment, and return theirvalues unless interrupted by

sOreturn-from.

(sOreturn-from foo [result NIL ])

(Mreturn [result NIL ])

⊲ Have nearest enclosingsOblock named foo/named NIL, re-

spectively, return with values of result .

(sOtagbody {ctag form}∗)

⊲ Evaluate forms in a lexical environment. tags (symbolsor integers) have lexical scope and dynamic extent, and aretargets for

sOgo. Return NIL.

(sOgo ctag)

⊲ Within the innermost possible enclosingsOtagbody, jump

to a tag eql tag .

(sOcatch tag form

P∗)⊲ Evaluate forms and return their values unless interruptedby

sOthrow.

(sOthrow tag form)

⊲ Have the nearest dynamically enclosingsOcatch with a tag

Fueq tag return with the values of form.

(Fusleep n) ⊲ Wait n seconds, return NIL.

9.6 Iteration

(

MdoMdo∗

ff(

var

(varˆstart [step]

˜)

ff∗) (stop result

P∗) (declare ddecl∗)∗

ctagform

ff∗)

⊲ EvaluatesOtagbody-like body with vars successively bound

according to the values of the corresponding start and step

forms. vars are bound in parallel/sequentially, respectively.Stop iteration when stop is T. Return values of result∗.Implicitly, the whole form is a

sOblock named NIL.

(Mdotimes (var i [result NIL ]) (declare ddecl∗)∗ {ctag form}∗)

⊲ EvaluatesOtagbody-like body with var successively bound

to integers from 0 to i− 1. Upon evaluation of result , var

is i . Implicitly, the whole form is asOblock named NIL.

20

Common Lisp Quick Reference

(Mdolist (var list [result NIL ]) (declare ddecl∗)∗ {ctag form}∗)

⊲ EvaluatesOtagbody-like body with var successively bound

to the elements of list . Upon evaluation of result , var isNIL. Implicitly, the whole form is a

sOblock named NIL.

9.7 Loop Facility

(Mloop form∗)

⊲ Simple Loop. If forms do not contain any atomic LoopFacility keywords, evaluate them forever in an implicit

sOblock

named NIL.

(Mloop clause∗)

⊲ Loop Facility. For Loop Facility keywords see below andFigure 1.

named n NIL ⊲ GiveMloop’s implicit

sOblock a name.

{with

var-s

(var-s∗)

ff[d-type] = foo}+

{and

var-p

(var-p∗)

ff[d-type] = bar}∗

where destructuring type specifier d-type has the formnfixnum float T NIL

˘of-type

type

(type∗)

ff¯o

⊲ Initialize (possibly trees of) local variables var-s se-quentially and var-p in parallel.

˘{for as}

var-s

(var-s∗)

ff[d-type]

+ ˘and

var-p

(var-p∗)

ff[d-type]

⊲ Begin of iteration control clauses. Initialize and step(possibly trees of) local variables var-s sequentially andvar-p in parallel. Destructuring type specifier d-type aswith with.

{upfrom from downfrom} start

⊲ Start stepping with start

{upto downto to below above} form

⊲ Specify form as the end value for stepping.{in on} list

⊲ Bind var to successive elements/tails, respec-tively, of list .

by {step 1 function #’cdr}⊲ Specify the (positive) decrement or increment orthe function of one argument returning the nextpart of the list.

= foo [then bar foo ]

⊲ Bind var initially to foo and later to bar .across vector

⊲ Bind var to successive elements of vector .being {the each}

⊲ Iterate over a hash table or a package.

{hash-key hash-keys} {of in} hash-table [using(hash-value value)]⊲ Bind var successively to the keys ofhash-table ; bind value to corresponding values.

{hash-value hash-values} {of in} hash-table [using(hash-key key)]⊲ Bind var successively to the values ofhash-table ; bind key to corresponding keys.

{symbol symbols present-symbol present-symbols

external-symbol external-symbols} [{of in}package var

∗package∗ ]

⊲ Bind var successively to the accessible sym-bols, or the present symbols, or the externalsymbols respectively, of package .

{do doing} form+

⊲ Evaluate forms in every iteration.

{if when unless} test i-clause {and j-clause}∗ [elsek-clause {and l-clause}∗] [end]⊲ If test returns T, T, or NIL, respectively, evaluatei-clause and j-clauses; otherwise, evaluate k-clause andl-clauses.it ⊲ Inside i-clause or k-clause: value of test .

return {form it}⊲ Return immediately, skipping any finally parts, withvalues of form or it.

21

Common Lisp Quick Reference

(loop

[nam

ed

nNIL]8 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > :

with

var

(var∗)ff

[d-type]=

foo{a

nd

var

(var∗)ff

[d-type]=

bar}∗

for

as

ff v

ar

(var∗)ff

[d-type]8 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > :

ˆupfrom

from

ffst

art

0

˜ˆ8 < :

upto

to belo

w

9 = ;fo

rm˜

from

start

dow

nto

above

fffo

rm

dow

nfrom

start

ˆ8 < :dow

nto

to above

9 = ;fo

rm˜

9 > > > > > > > > > = > > > > > > > > > ;

[by

step1]

in on

fflist

[by

function

#’c

dr]

=fo

o[then

bar

foo]

acr

oss

vec

tor

bein

g

th

eeach

ff

8 > > > > > > > < > > > > > > > :

hash

-key[

s]

of

in

ffhash

[using

(hash

-valu

ev)]

hash

-valu

e[s

]of

in

ffhash

[using

(hash

-key

k)]

sym

bol[s]

pre

sent-

sym

bol[s]

ext

ern

al-sy

mbol[s]

9 = ;ˆ

of

in

ffpackage

var

∗pack

age∗

˜9 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > = > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ;F0

n and

Fi

o ∗

T1

9 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > = > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ;∗8 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > :

do[ing]fo

rm+

if when

unle

ss

9 = ;te

stC

i{a

nd

Cj}∗

[else

Ck{a

nd

Cl}∗

][end]

retu

rn

fo

rm

itco

llect

[ing]

append[ing]

nco

nc[

ing]

9 = ;

fo

rm

it

ff[into

list

]

count[in

g]

sum

[min

g]

maxi

miz

em

axi

miz

ing

min

imiz

em

inim

izin

g

9 > > > > > = > > > > > ;

fo

rm

it

ff[into

num

][type]

C0

initia

lly

finally

fffo

rm+

repeatnum

while

until

alw

ays

neve

rth

ere

is

9 > > > = > > > ;te

st

T2

9 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > = > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ;∗ )

Figure 1: Loop Facility,Overview.

22

Common Lisp Quick Reference

{collect collecting} {form it} [into list ]⊲ Collect values of form or it into list . If no list isgiven, collect into an anonymous list which is returnedafter termination.

{append appending nconc nconcing} {form it} [into list ]⊲ Concatenate values of form or it, which should belists, into list by the means of

Fuappend or

Funconc, respec-

tively. If no list is given, collect into an anonymous listwhich is returned after termination.

{count counting} {form it} [into n ] [type]⊲ Count the number of times the value of form or of itis T. If no n is given, count into an anonymous variablewhich is returned after termination.

{sum summing} {form it} [into sum] [type]⊲ Calculate the sum of the primary values of form or ofit. If no sum is given, sum into an anonymous variablewhich is returned after termination.

{maximize maximizing minimize minimizing} {form it} [intomax-min] [type]⊲ Determine the maximum or minimum, respectively,of the primary values of form or of it. If no max-min

is given, use an anonymous variable which is returnedafter termination.

{initially finally} form+

⊲ Evaluate forms before begin, or after end, respec-tively, of iterations.

repeat num

⊲ TerminateMloop after num iterations; num is evalu-

ated once.

{while until} test

⊲ Continue iteration until test returns NIL or T, respec-tively.

{always never} test

⊲ TerminateMloop returning NIL and skipping any finally

parts as soon as test is NIL or T, respectively. Otherwisecontinue

Mloop with its default return value set to T.

thereis test

⊲ TerminateMloop when test is T and return value of test ,

skipping any finally parts. Otherwise continueMloop with

its default return value set to NIL.(

Mloop-finish)

⊲ TerminateMloop immediately executing any finally

clauses and returning any accumulated results.

10 CLOS

10.1 Classes

(Fuslot-exists-p foo bar) ⊲ T if foo has a slot bar .

(Fuslot-boundp instance slot) ⊲ T if slot in instance is bound.

(Mdefclass foo (superclass∗ standard-object )

(

8>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>:

slot

(slot

8>>>>>>>>>>>>><>>>>>>>>>>>>>:

˛˛˛˛˛˛˛˛˛˛

{:reader reader}∗

{:writer

writer

(setf writer)

ff}∗

{:accessor accessor}∗

:allocation

:instance:class

ff:instance

{:initarg :initarg-name}∗:initform form

:type type

:documentation slot-doc

9>>>>>>>>>>>>>=>>>>>>>>>>>>>;

)

9>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>;

)

8<:

˛˛˛(:default-initargs {name value}∗)(:documentation class-doc)(:metaclass name standard-class )

9=;)

⊲ Define, as a subclass of superclasses, class foo . In a newinstance i , a slot ’s value defaults to form unless set via:initarg-name; it is readable via (reader i) or (accessori), and writeable via (writer i value) or (setf (accessori) value). With :allocation :class, slot is shared by all in-stances of class foo.

23

Common Lisp Quick Reference

(Fufind-class symbol

ˆerrorp T [environment ]

˜)

⊲ Return class named symbol . setfable.

(gFmake-instance class {:initarg value}∗ other-keyarg∗)

⊲ Make new instance of class .

(gFreinitialize-instance instance {:initarg value}∗ other-keyarg∗)

⊲ Change local slots of instance according to initargs.

(Fuslot-value foo slot) ⊲ Return value of slot in foo . setfable.

(Fuslot-makunbound instance slot)

⊲ Make slot in instance unbound.

(

Mwith-slots ({dslot (dvar dslot)}∗)Mwith-accessors ((dvar accessor)∗)

ffinstance (declare ddecl∗)∗

formP∗)

⊲ Return values of forms after evaluating them in a lexicalenvironment with slots of instance visible as setfable slotsor vars/with accessors of instance visible as setfable vars.

(gFclass-name class)

((setfgFclass-name) new-name class)

⊲ Get/set name of class .

(Fuclass-of foo) ⊲ Class foo is a direct instance of.

(gFchange-class ˜instance new-class {:initarg value}∗ other-keyarg∗)

⊲ Change class of instance to new-class.

(gFmake-instances-obsolete class)

⊲ Update instances of class.

(

gFinitialize-instance (instance)gFupdate-instance-for-different-class previous current

ff

{:initarg value}∗ other-keyarg∗)⊲ Its primary method sets slots on behalf ofgFmake-instance/of

gFchange-class by means of

gFshared-initialize.

(gFupdate-instance-for-redefined-class instances added-slots

discarded-slots property-list {:initarg value}∗other-keyarg∗)⊲ Its primary method sets slots on behalf ofgFmake-instances-obsolete by means of

gFshared-initialize.

(gFallocate-instance class {:initarg value}∗ other-keyarg∗)

⊲ Return uninitialized instance of class. Called bygFmake-instance.

(gFshared-initialize instance

slots

T

ff{:initarg value}∗ other-keyarg∗)

⊲ Fill instance’s slots using initargs and :initform forms.

(gFslot-missing class object slot

8>><>>:

setfslot-boundpslot-makunboundslot-value

9>>=>>;

[value])

⊲ Called in case of attempted access to missing slot . Itsprimary method signals error.

(gFslot-unbound class instance slot)

⊲ Called byFuslot-value in case of unbound slot . Its primary

method signals unbound-slot.

10.2 Generic Functions

(Funext-method-p)

⊲ T if enclosing method has a next method.

(Mdefgeneric

foo

(setf foo)

ff(required-var∗

ˆ&optional

var

(var)

ff∗˜

ˆ&rest var

˜ ˆ&key

var

(var (:key var))

ff∗

[&allow-other-keys]˜)

24

Common Lisp Quick Reference

8>>>>>>>><>>>>>>>>:

˛˛˛˛˛˛˛

(:argument-precedence-order required-var+)(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)∗

9>>>>>>>>=>>>>>>>>;

)

⊲ Define generic function foo. defmethod-args resemblethose of

Mdefmethod. For c-type see section 10.3.

(Fuensure-generic-function

foo

(setf foo)

ff

8>>>>>>>>><>>>>>>>>>:

˛˛˛˛˛˛˛˛

: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

9>>>>>>>>>=>>>>>>>>>;

)

⊲ 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 existingmethods, respectively. Changes to :method-class do notpropagate to existing methods. For c-type see section 10.3.

(Mdefmethod

foo

(setf foo)

ff[

8>><>>:

:before:after:aroundqualifier∗

9>>=>>;

primary method ]

(

8<:var

(spec-var

class

(eql bar)

ff)

9=;

∗ˆ&optional

var

(varˆinit [supplied-p]

˜)

ff∗˜[&rest var ]

ˆ&key

8<:var

(

var

(:key var)

ffˆinit [supplied-p]

˜)

9=;

[&allow-other-keys]˜

ˆ&aux

var

(var [init ])

ff∗˜)

(˛˛(declare ddecl∗)∗

ddoc

)form

P∗)

⊲ Define new method for generic function foo. spec-varsspecialize to either being of class or being eql bar , re-spectively. On invocation, vars and spec-vars of the newmethod act like parameters of a function with body form∗.forms are enclosed in an implicit

sOblock foo. Applicable

qualifiers depend on the method-combination type; see sec-tion 10.3.

(

gFadd-methodgFremove-method

ffgeneric-function method)

⊲ Add (if necessary) or remove (if any) method to/fromgeneric-function.

(gFfind-method generic-function qualifiers specializers [error T ])

⊲ Return suitable method, or signal error.

(gFcompute-applicable-methods generic-function args)

⊲ List of methods suitable for args, most specific first.

(Fucall-next-method arg∗

current args )⊲ From within a method, call next method with args; re-turn its values.

(gFno-applicable-method generic-function arg∗)

⊲ Called on invocation of generic-function on args if thereis no applicable method. Default method signals error.

(

Fuinvalid-method-error methodFumethod-combination-error

ffcontrol arg∗)

⊲ Signal error on applicable method with invalid qualifiers,or on method combination. For control and args see format,p. 35.

(gFno-next-method generic-function method arg∗)

⊲ Called on invocation of call-next-method when there isno next method. Default method signals error.

25

Common Lisp Quick Reference

(gFfunction-keywords method)

⊲ Return list of keyword parameters of method and2T if

other keys are allowed.

(gFmethod-qualifiers method) ⊲ List of qualifiers of method .

10.3 Method Combination Types

standard⊲ Evaluate most specific :around method supplying the val-ues of the generic function. From within this method,Fucall-next-method can call less specific :around methods ifthere are any. If not, or if there are no :around methodsat all, call all :before methods, most specific first, and themost specific primary method which supplies the values ofthe calling

Fucall-next-method if any, or of the generic func-

tion; and which can call less specific primary methods viaFucall-next-method. After its return, call all :after methods,least specific first.

and or append list nconc progn max min +⊲ Simple built-in method-combination types; have thesame usage as the c-types defined by the short form ofMdefine-method-combination.

(Mdefine-method-combination c-type8

<:

˛˛˛:documentation string

:identity-with-one-argument bool NIL:operator operator c-type

9=;)

⊲ Short Form. Define new method-combination c-type.In a generic function using c-type, evaluate most spe-cific :around method supplying the values of the genericfunction. From within this method,

Fucall-next-method

can call less specific :around methods if there are any.If not, or if there are no :around methods at all,return from the calling call-next-method or from thegeneric function, respectively, the values of (operator(primary-method gen-arg∗)∗), gen-arg∗ being the argu-ments of the generic function. The primary-methods are

orderedˆ

:most-specific-first:most-specific-last

ff:most-specific-first

˜(specified as

c-arg inMdefgeneric). Using c-type as the qualifier in

Mdefmethod makes the method primary.

(Mdefine-method-combination c-type (ord-λ∗) ((group8

<:

(qualifier∗ˆ∗

˜)

predicate

9=;

8>><>>:

˛˛˛˛

:description control

:order

:most-specific-first:most-specific-last

ff:most-specific-first

:required bool

9>>=>>;

)∗)

8>><>>:

˛˛˛˛

(:arguments method-combination-λ∗)(:generic-function symbol)

(declare ddecl∗)∗

ddoc

9>>=>>;

bodyP∗)

⊲ Long Form. Define new method-combination c-type. Acall to a generic function using c-type will be equivalent toa call to the forms returned by body∗ with ord-λ∗ bound toc-arg∗ (cf.

Mdefgeneric), with symbol bound to the generic

function, with method-combination-λ∗ bound to the argu-ments of the generic function, and with groups bound tolists of methods. An applicable method becomes a mem-ber of the leftmost group whose predicate or qualifiersmatch. Methods can be called via

Mcall-method. Lambda

lists (ord-λ∗) and (method-combination-λ∗) according toord-λ on p. 16, the latter enhanced by an optional &wholeargument.

(Mcall-method

(method

(Mmake-method form)

)ˆ(

(next-method

(Mmake-method form)

)∗

)˜)

⊲ From within an effective method form, call method withthe arguments of the generic function and with informationabout its next-methods; return its values.

26

Common Lisp Quick Reference

11 Conditions and Errors

For standardized condition types cf. Figure 2 on page 30.

(Mdefine-condition foo (parent-type∗

condition )

(

8>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>:

slot

(slot

8>>>>>>>>>>>>><>>>>>>>>>>>>>:

˛˛˛˛˛˛˛˛˛˛

{:reader reader}∗

{:writer

writer

(setf writer)

ff}∗

{:accessor accessor}∗

:allocation

:instance:class

ff:instance

{:initarg :initarg-name}∗:initform form

:type type

:documentation slot-doc

9>>>>>>>>>>>>>=>>>>>>>>>>>>>;

)

9>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>;

)

8>><>>:

˛˛˛˛

(:default-initargs {name value}∗)(:documentation condition-doc)

(:report

string

report-function

ff)

9>>=>>;

)

⊲ Define, as a subtype of parent-types, condition type foo.In a new condition, a slot ’s value defaults to form unless setvia :initarg-name ; it is readable via (reader i) or (accessori), and writeable via (writer i value) or (setf (accessor i)value). With :allocation :class, slot is shared by all condi-tions of type foo. A condition is reported by string or byreport-function of arguments condition and stream.

(Fumake-condition type {:initarg-name value}∗)

⊲ Return new condition of type .

(

8<:

FusignalFuwarnFuerror

9=;

8<:condition

type {:initarg-name value}∗control arg∗

9=;)

⊲ Unless handled, signal as condition, warning or error,respectively, condition or a new condition of type or,with

Fuformat control and args (see p. 35), simple-condition,

simple-warning, or simple-error, respectively. FromFusignal

andFuwarn, return NIL.

(Fucerror continue-control

8<:condition continue-arg∗

type {:initarg-name value}∗control arg∗

9=;)

⊲ Unless handled, signal as correctable error condition or anew condition of type or, with

Fuformat control and args (see

p. 35), simple-error. In the debugger, useFuformat arguments

continue-control and continue-args to tag the continue op-tion. Return NIL.

(Mignore-errors form

P∗)⊲ Return values of form s or, in case of errors, NIL and the

2condition.

(Fuinvoke-debugger condition)

⊲ Invoke debugger with condition .

(Massert test

ˆ(place∗) [

8<:condition continue-arg∗

type {:initarg-name value}∗control arg∗

9=;]

˜)

⊲ If test, which may depend on places, returns NIL, signalas correctable error condition or a new condition of type or,with

Fuformat control and args (see p. 35), error. When using

the debugger’s continue option, places can be altered beforere-evaluation of test . Return NIL.

(Mhandler-case foo (type ([var ]) (declare ddecl∗)∗ condition-form

P∗)∗

[(:no-error (ord-λ∗) (declare ddecl∗)∗ formP∗)])

⊲ If, on evaluation of foo, a condition of type is signalled,evaluate matching condition-forms with var bound to thecondition, and return their values. Without a condition,bind ord-λs to values of foo and return values of forms or,without a :no-error clause, return values of foo . See p. 16for (ord-λ∗).

(Mhandler-bind ((condition-type handler-function)∗) form

P∗)⊲ Return values of form s after evaluating them withcondition-types dynamically bound to their respectivehandler-functions of argument condition.

27

Common Lisp Quick Reference

(Mwith-simple-restart (

restart

NIL

ffcontrol arg∗) form

P∗)

⊲ Return values of forms unless restart is called duringtheir evaluation. In this case, describe restart using

Fuformat

control and args (see p. 35) and return NIL and2T.

(Mrestart-case form (foo (ord-λ∗)

8>><>>:

˛˛˛˛

:interactive arg-function

:report

report-function

string "foo"

:test test-function T

9>>=>>;

(declare ddecl∗)∗ restart-formP∗)∗)

⊲ Evaluate form with dynamically established restarts foo.Return values of form or, if by (

Fuinvoke-restart foo arg∗)

one restart foo is called, use string or report-function (ofa stream) to print a description of restart foo and returnthe values of its restart-forms. arg-function supplies ap-propriate args if foo is called by

Fuinvoke-restart-interactively.

If (test-function condition) returns T, foo is made visibleunder condition . arg∗ matches (ord-λ∗); see p. 16 for thelatter.

(Mrestart-bind ((

restart

NIL

ffrestart-function

8<:

˛˛˛:interactive-function function

:report-function function

:test-function function

9=;)∗) form

P∗)

⊲ Return values of forms evaluated with restarts dynami-cally bound to restart-functions.

(Fuinvoke-restart restart arg∗)

(Fuinvoke-restart-interactively restart)

⊲ Call function associated with restart with argumentsgiven or prompted for, respectively. If restart function re-turns, return its values.

(

Fucompute-restartsFufind-restart name

ff[condition ])

⊲ Return list of all restarts, or innermost restart name,respectively, out of those either associated with condition

or un-associated at all; or, without condition , out of allrestarts. Return NIL if search is unsuccessful.

(Furestart-name restart) ⊲ Name of restart .

(

8>>><>>>:

FuabortFumuffle-warningFucontinueFustore-value valueFuuse-value value

9>>>=>>>;

[condition NIL ])

⊲ Transfer control to innermost applicable restart withsame name (i.e. abort, . . . , continue . . . ) out of thoseeither associated with condition or un-associated at all; or,without condition , out of all restarts. If no restart is found,signal control-error for

Fuabort and

Fumuffle-warning, or return

NIL for the rest.

(Mwith-condition-restarts condition restarts form

P∗)⊲ Evaluate forms with restarts dynamically associatedwith condition . Return values of forms.

(Fuarithmetic-error-operation condition)

(Fuarithmetic-error-operands condition)

⊲ List of function or of its operands respectively, used inthe operation which caused condition .

(Fucell-error-name condition)

⊲ Name of cell which caused condition .

(Fuunbound-slot-instance condition)

⊲ Instance with unbound slot which caused condition .

(Fuprint-not-readable-object condition)

⊲ The object not readably printable under condition .

(Fupackage-error-package condition)

(Fufile-error-pathname condition)

(Fustream-error-stream condition)

⊲ Package, path, or stream, respectively, which caused thecondition of indicated type.

28

Common Lisp Quick Reference

(Futype-error-datum condition)

(Futype-error-expected-type condition)

⊲ Object which caused condition of type type-error, or itsexpected type, respectively.

(Fusimple-condition-format-control condition)

(Fusimple-condition-format-arguments condition)

⊲ ReturnFuformat control or list of

Fuformat 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 beforedebugger.

12 Types and Classes

For any class, there is always a corresponding type of the samename.

(Futypep foo type [environment NIL ]) ⊲ T if foo is of type.

(Fusubtypep type-a type-b [environment ])

⊲ Return T if type-a is a recognizable subtype of type-b,and

2NIL if the relationship could not be determined.

(sOthe dtype form) ⊲ Declare values of form to be of type.

(Fucoerce object type) ⊲ Coerce object into type.

(Mtypecase foo ( dtype a-form

P∗)∗ˆ(

otherwiseT

ffb-form NIL

P∗)˜)

⊲ Return values of the a-form s whose type is foo of. Returnvalues of b-forms if no type matches.

(

MctypecaseMetypecase

fffoo ( dtype form

P∗)∗)

⊲ Return values of the form s whose type is foo of. Sig-nal correctable/non-correctable error, respectively if no type

matches.

(Futype-of foo) ⊲ Type of foo .

(Mcheck-type place type [string

{a an} type])

⊲ Signal correctable type-error if place is not of type. Re-turn NIL.

(Fustream-element-type stream) ⊲ Return type of stream objects.

(Fuarray-element-type array) ⊲ Element type array can hold.

(Fuupgraded-array-element-type type [environment NIL ])

⊲ Element type of most specialized array capable of holdingelements of type.

(Mdeftype foo (macro-λ∗) (declare ddecl∗)∗ [ddoc] form

P∗)⊲ Define type foo which when referenced as (foo carg∗) ap-plies expanded forms to args returning the new type. For(macro-λ∗) see p. 18 but with default value of ∗ instead ofNIL. forms are enclosed in an implicit

sOblock named foo.

(eql foo)(member foo∗)

⊲ Specifier for a type comprising foo or foos.

(satisfies predicate)⊲ Type specifier for all objects satisfying predicate .

(mod n) ⊲ Type specifier for all non-negative integers < n.

(not type) ⊲ Complement of type.

(and type∗T ) ⊲ Type specifier for intersection of types.

(or type∗ NIL ) ⊲ Type specifier for union of types.

(values type∗ˆ&optional type∗ [&rest other-args ]

˜)

⊲ Type specifier for multiple values.

∗ ⊲ As a type argument (cf. Figure 2): no restriction.

29

Common Lisp Quick Reference

Tato

m

readta

ble

pack

age

sym

bol

keyw

ord

boole

an

rest

art

random

-sta

te

hash

-table

stru

cture

-obje

ct

standar

d-o

bje

ct

null

class

built-

in-c

lass

standar

d-c

lass

stru

cture

-cla

ss

meth

od

standar

d-m

eth

od

meth

od-c

om

bin

ation

chara

cter

funct

ion

ˆ arg

-types

[valu

e-types]˜

com

piled-funct

ion

generic-

funct

ion

standar

d-g

eneric-

funct

ion

path

nam

e

logic

al-path

nam

enum

ber

com

ple

x[type

∗]

real

ˆ lower-

lim

it∗

[upper-

lim

it∗]˜

float

ˆ lower-

lim

it∗

[upper-

lim

it∗]˜

short

-float

ˆ lower-

lim

it∗

[upper-

lim

it∗]˜

single

-float

ˆ lower-

lim

it∗

[upper-

lim

it∗]˜

double

-float

ˆ lower-

lim

it∗

[upper-

lim

it∗]˜

long-fl

oat

ˆ lower-

lim

it∗

[upper-

lim

it∗]˜

rational

ˆ lower-

lim

it∗

[upper-

lim

it∗]˜

inte

ger

ˆ lower-

lim

it∗

[upper-

lim

it∗]˜

ratio

signed-b

yte

[size

∗]

fixn

um

big

num

unsigned-b

yte

[size

∗]

bit

list

sequence

cons

ˆ car-

type

∗[cdr-

type

∗]˜

arra

yˆ ty

pe

∗[rank

∗(d

imension∗)]

˜

sim

ple

-arr

ayˆ ty

pe

∗[rank

∗(d

imension∗)]

˜

vect

or

ˆ type

∗[size

∗]˜

string

[size

∗]

sim

ple

-str

ing

[size

∗]

base

-str

ing

[size

∗]

sim

ple

-base

-str

ing

[size

∗]

sim

ple

-vect

or

[size

∗]

bit-v

ect

or

[size

∗]

sim

ple

-bit-v

ect

or

[size

∗]

stre

am

file

-str

eam

two-w

ay-s

tream

synonym

-str

eam

string-s

tream

bro

adca

st-s

tream

conca

tenate

d-s

tream

ech

o-s

tream

ext

ended-c

har

base

-char

standar

d-c

har

conditio

n

serious-

conditio

nst

ora

ge-c

onditio

n

sim

ple

-typ

e-e

rror

type-e

rror

err

or pro

gra

m-e

rror

contr

ol-err

or

pack

age-e

rror

print-

not-

readable

stre

am

-err

or

par

se-e

rror

cell-e

rror

file

-err

or

arithm

etic-

err

or

sim

ple

-conditio

n

war

nin

g

styl

e-w

arnin

g

sim

ple

-err

or

sim

ple

-war

nin

g

end-o

f-file

reader-

err

or

unbound-v

ariable

undefined-funct

ion

unbound-s

lot

div

isio

n-b

y-ze

ro

floating-p

oin

t-in

exa

ct

floating-p

oin

t-ove

rflow

floating-p

oin

t-underfl

ow

floating-p

oin

t-in

valid-o

pera

tion

Figure 2: Precedence Order of System Classes ( ), Classes ( ),Types ( ), and Condition Types ( ).

30

Common Lisp Quick Reference

13 Input/Output

13.1 Predicates

(Fustreamp foo)

(Fupathnamep foo)

(Fureadtablep foo)

⊲ T if foo is of indicated type.

(Fuinput-stream-p stream)

(Fuoutput-stream-p stream)

(Fuinteractive-stream-p stream)

(Fuopen-stream-p stream)

⊲ Return T if stream is for input, for output, interactive, oropen, respectively.

(Fupathname-match-p path wildcard)

⊲ T if path matches wildcard .

(Fuwild-pathname-p path

ˆ{:host :device :directory :name :type

:version NIL}˜)

⊲ Return T if indicated component in path is wildcard. (NILindicates any component.)

13.2 Reader

(

Fuy-or-n-pFuyes-or-no-p

ff[control arg∗])

⊲ Ask user a question and return T or NIL depending ontheir answer. See p. 35,

Fuformat, for control and args.

(Mwith-standard-io-syntax form

P∗)⊲ Evaluate forms with standard behaviour of reader andprinter. Return values of forms.

(

FureadFuread-preserving-whitespace

ff ˆstream var

∗standard-input∗

ˆeof-err T

[eof-val NIL [recursive NIL ]]˜˜

)⊲ Read printed representation of object.

(Furead-from-string string

ˆeof-error T

ˆeof-val NIL

ˆ8<:

˛˛˛:start start 0:end end NIL

:preserve-whitespace bool NIL

9=;

˜˜˜)

⊲ Return object read from string and zero-indexed2position

of next character.

(Furead-delimited-list char

ˆstream var

∗standard-input∗ [recursive NIL ]˜)

⊲ Continue reading until encountering char . Return list ofobjects read. Signal error if no char is found in stream.

(Furead-char

ˆstream var

∗standard-input∗

ˆeof-err T [eof-val NIL

[recursive NIL ]]˜˜

)⊲ Return next character from stream .

(Furead-char-no-hang

ˆstream var

∗standard-input∗

ˆeof-error T [eof-val NIL

[recursive NIL ]]˜˜

)⊲ Next character from stream or NIL if none is available.

(Fupeek-char

ˆmode NIL

ˆstream var

∗standard-input∗

ˆ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.

(Fuunread-char character [stream var

∗standard-input∗ ])

⊲ Put lastFuread-chared character back into stream; return

NIL.

(Furead-byte stream

ˆeof-err T [eof-val NIL ]

˜)

⊲ Read next byte from binary stream .

(Furead-line

ˆstream var

∗standard-input∗

ˆeof-err T [eof-val NIL

[recursive NIL ]]˜˜

)⊲ Return a line of text from stream and

2T if line has been

ended by end of file.

31

Common Lisp Quick Reference

(Furead-sequence ˜sequence stream [:start start 0 ][:end end NIL ])

⊲ Replace elements of sequence between start and end withelements from binary or character stream . Return index ofsequence’s first unmodified element.

(Fureadtable-case readtable) :upcase

⊲ Case sensitivity attribute (one of :upcase, :downcase,:preserve, :invert) of readtable . setfable.

(Fucopy-readtable

ˆfrom-readtable var

∗readtable∗ [ ˜to-readtable NIL ]˜)

⊲ Return copy of from-readtable .

(Fuset-syntax-from-char to-char from-char

ˆ˜to-readtable var

∗readtable∗

[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 thenumber read.

var∗read-suppress∗NIL

⊲ If T, reader is syntactically more tolerant.

(Fuset-macro-character char function

ˆnon-term-p NIL [ ert var

∗readtable∗ ]˜)

⊲ Make char a macro character associated with function

of stream and char . Return T.

(Fuget-macro-character char [rt var

∗readtable∗ ])⊲ Reader macro function associated with char , and

2T if

char is a non-terminating macro character.

(Fumake-dispatch-macro-character char

ˆnon-term-p NIL

[rt var∗readtable∗ ]

˜)

⊲ Make char a dispatching macro character. Return T.

(Fuset-dispatch-macro-character char sub-char function

[ ert var∗readtable∗ ])

⊲ Make function of stream, n , sub-char a dispatch functionof char followed by n , followed by sub-char . Return T.

(Fuget-dispatch-macro-character char sub-char [rt var

∗readtable∗ ])⊲ Dispatch function associated with char followed bysub-char .

13.3 Character Syntax

#| multi-line-comment∗ |#; one-line-comment∗

⊲ Comments. There are stylistic conventions:

;;;; title ⊲ Short title for a block of code.

;;; intro ⊲ Description before a block of code.

;; state ⊲ State of program or of following code.

;explanation

; continuation⊲ Regarding line on which it appears.

(foo∗[ . bar NIL ]) ⊲ List of foos with the terminating cdr bar .

” ⊲ Begin and end of a string.

’foo ⊲ (sOquote foo); foo unevaluated.

`([foo] [,bar ] [,@baz ] [,.quux ] [bing])⊲ Backquote.

sOquote foo and bing ; evaluate bar and splice

the lists baz and quux into their elements. When nested,outermost commas inside the innermost backquote expres-sion belong to this backquote.

#\c ⊲ (Fucharacter "c"), the character c.

#Bn; #On; n.; #Xn ; #rRn

⊲ Integer of radix 2, 8, 10, 16, or r ; 2 ≤ r ≤ 36.

32

Common Lisp Quick Reference

n/d ⊲ The ratio nd.

n[m].n

ˆ{S F D L E}x E0

˜m

ˆ.[n ]

˜{S F D L E}x

o

⊲ m.n · 10x as short-float, single-float, double-float,long-float, or the type from ∗read-default-float-format∗.

#C(a b) ⊲ (Fucomplex a b), the complex number a + bi.

#’foo ⊲ (sOfunction foo); the function named foo.

#nAsequence ⊲ n-dimensional array.

#[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.

#S(type {slot value}∗) ⊲ Structure of type.

#Pstring ⊲ A pathname.

#:foo ⊲ Uninterned symbol foo.

#.form ⊲ Read-time value of form .

var∗read-eval∗T ⊲ If NIL, a reader-error is signalled at #..

#integer= foo ⊲ Give foo the label integer.

#integer# ⊲ Object labelled integer.

#< ⊲ Have the reader signal reader-error.

#+feature when-feature

#–feature unless-feature

⊲ Means when-feature if feature is T; means unless-feature

if feature is NIL. feature is a symbol fromvar

∗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 preservingcase.

13.4 Printer

(

8>><>>:

Fuprin1FuprintFupprintFuprinc

9>>=>>;

foo [stream var∗standard-output∗ ])

⊲ Print foo to streamFureadably,

Fureadably between a newline

and a space,Fureadably after a newline, or human-readably

without any extra characters, respectively.Fuprin1,

Fuprint and

Fuprinc return foo.

(Fuprin1-to-string foo)

(Fuprinc-to-string foo)

⊲ Print foo to stringFureadably or human-readably, respec-

tively.

(gFprint-object object stream)

⊲ Print object to stream . Called by the Lisp printer.

(Mprint-unreadable-object (foo stream

˛:type bool NIL:identity bool NIL

ff) form

P∗)

⊲ Enclosed in #< and >, print foo by means of forms tostream. Return NIL.

(Futerpri [stream var

∗standard-output∗ ])

⊲ Output a newline to stream. Return NIL.

(Fufresh-line) [stream var

∗standard-output∗ ]

⊲ Output a newline to stream and return T unless stream

is already at the start of a line.

33

Common Lisp Quick Reference

(Fuwrite-char char [stream var

∗standard-output∗ ])

⊲ Output char to stream .

(

Fuwrite-stringFuwrite-line

ffstring

ˆstream var

∗standard-output∗

ˆ˛:start start 0:end end NIL

ff˜˜)

⊲ Write string to stream without/with a trailing newline.

(Fuwrite-byte byte stream) ⊲ Write byte to binary stream .

(Fuwrite-sequence sequence stream

˛:start start 0:end end NIL

ff)

⊲ Write elements of sequence to binary or character stream.

(

FuwriteFuwrite-to-string

fffoo

8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>:

˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛

:array bool

:base radix

:case

8<:

:upcase:downcase:capitalize

:circle bool

:escape bool

:gensym bool

:length {int NIL}:level {int NIL}:lines {int NIL}:miser-width {int NIL}:pprint-dispatch dispatch-table

:pretty bool

:radix bool

:readably bool

:right-margin {int NIL}:stream stream var

∗standard-output∗

9>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;

)

⊲ Print foo to stream and return foo, or print foo intostring, respectively, after dynamically setting printer vari-ables corresponding to keyword parameters (∗print-bar∗ be-coming :bar). (:stream keyword with

Fuwrite only.)

(Fupprint-fill stream foo

ˆparenthesis T [noop]

˜)

(Fupprint-tabular stream foo

ˆparenthesis T [noop [n 16 ]]

˜)

(Fupprint-linear stream foo

ˆparenthesis T [noop]

˜)

⊲ Print foo to stream. If foo is a list, print as many elementsper line as possible; do the same in a table with a columnwidth of n ems; or print either all elements on one line oreach on its own line, respectively. Return NIL. Usable withFuformat directive ˜//.

(Mpprint-logical-block (stream list

8<:

˛˛˛

:prefix string

:per-line-prefix string

ff

:suffix string ""

9=;)

(declare ddecl∗)∗ formP∗)

⊲ Evaluate forms, which should print list , with stream lo-cally bound to a pretty printing stream which outputs tothe original stream . If list is in fact not a list, it is printedby

Fuwrite. Return NIL.

(Mpprint-pop)

⊲ Take next element off list . If there is no remainingtail of list , or

var∗print-length∗ or

var∗print-circle∗ indicate

printing should end, send element together with an ap-propriate indicator to stream .

(Fupprint-tab

8>><>>:

:line:line-relative:section:section-relative

9>>=>>;

c i [stream var∗standard-output∗ ])

⊲ Move cursor forward to column number c + ki, k ≥ 0being as small as possible.

(Fupprint-indent

:block:current

ffn

ˆstream var

∗standard-output∗

˜)

⊲ Specify indentation for innermost logical block rel-ative to leftmost position/to current position. ReturnNIL.

(Mpprint-exit-if-list-exhausted)

⊲ If list is empty, terminate logical block. Return NIL

otherwise.

34

Common Lisp Quick Reference

(Fupprint-newline

8>><>>:

:linear:fill:miser:mandatory

9>>=>>;

ˆstream var

∗standard-output∗

˜)

⊲ Print a conditional newline if stream is a pretty printingstream. Return NIL.

var∗print-array∗ ⊲ If T, print arrays

Fureadably.

var∗print-base∗10 ⊲ Radix for printing rationals, from 2 to 36.

var∗print-case∗ :upcase

⊲ Print symbol names all uppercase (:upcase), all lowercase(:downcase), capitalized (:capitalize).

var∗print-circle∗NIL

⊲ If T, avoid indefinite recursion while printing circularstructure.

var∗print-escape∗T

⊲ If NIL, do not print escape characters and package pre-fixes.

var∗print-gensym∗T

⊲ If T, print #: before uninterned symbols.

var∗print-length∗NIL

var∗print-level∗NIL

var∗print-lines∗NIL

⊲ If integer, restrict printing of objects to that number ofelements per level/to that depth/to that number of lines.

var∗print-miser-width∗

⊲ If integer and greater than the width available for print-ing a substructure, switch to the more compact miser style.

var∗print-pretty∗ ⊲ If T, print pretty.

var∗print-radix∗NIL ⊲ If T, print rationals with a radix indicator.

var∗print-readably∗NIL

⊲ If T, printFureadably or signal error print-not-readable.

var∗print-right-margin∗NIL

⊲ Right margin width in ems while pretty-printing.

(Fuset-pprint-dispatch type function

ˆpriority 0

[table var∗print-pprint-dispatch∗ ]

˜)

⊲ Install entry comprising function of arguments streamand object to print; and priority as type into table. Iffunction is NIL, remove type from table. Return NIL.

(Fupprint-dispatch foo [table var

∗print-pprint-dispatch∗ ])

⊲ Return highest priority function associated with type offoo and

2T if there was a matching type specifier in table.

(Fucopy-pprint-dispatch [table var

∗print-pprint-dispatch∗ ])

⊲ Return copy of table or, if table is NIL, initial value ofvar

∗print-pprint-dispatch∗.

var∗print-pprint-dispatch∗ ⊲ Current pretty print dispatch table.

13.5 Format

(Mformatter control)

⊲ Return function of stream and a &rest argument applyingFuformat to stream, control , and the &rest argument return-ing NIL or any excess arguments.

(Fuformat {T NIL out-string out-stream} control arg∗)

⊲ Output string control which may contain ˜ directivespossibly taking some args. Alternatively, control can bea function returned by

Mformatter which is then applied to

out-stream and arg∗. Output to out-string , out-stream or,if first argument is T, to

var∗standard-output∗. Return NIL. If

first argument is NIL, return formatted output.

35

Common Lisp Quick Reference

˜ [min-col 0 ]ˆ,[col-inc 1 ]

ˆ,[min-pad 0 ]

ˆ,pad-char ’

˜˜˜

[:] [@] {A S}⊲ Aesthetic/Standard. Print argument of any type forconsumption by humans/by the reader, respectively.With :, print NIL as () rather than nil; with @, addpad-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 digitscomma-interval each; with @, always prepend a sign.

{˜R ˜:R ˜@R ˜@:R}⊲ Roman. Take argument as number and print it asEnglish cardinal number, as English ordinal number, asRoman numeral, or as old Roman numeral, respectively.

˜ [width]ˆ,[pad-char ’ ]

ˆ,[comma-char ’, ]ˆ

,comma-interval 3˜˜˜

[:] [@] {D B O X}⊲ Decimal/Binary/Octal/Hexadecimal. Print integerargument as number. With :, group digitscomma-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 argumentas floating-point number with int-digits before decimalpoint and exp-digits in the signed exponent. With ˜G,choose either ˜E or ˜F. With @, always prepend a sign.

˜ [dec-digits 2 ]ˆ,[int-digits 1 ]

ˆ,[width 0 ]

ˆ,pad-char ’

˜˜˜[:]

[@] $

⊲ Monetary Floating-Point. Print argument as fixed-format floating-point number. With :, put sign beforeany padding; with @, always prepend a sign.

{˜C ˜:C ˜@C ˜@:C}⊲ Character. Print, spell out, print in #\ syntax, ortell how to type, respectively, argument as (possiblynon-printing) character.

{˜( text ˜) ˜:( text ˜) ˜@( text ˜) ˜:@( text ˜)}⊲ Case-Conversion. Convert text to lowercase, convertfirst letter of each word to uppercase, capitalize firstword and convert the rest to lowercase, or convert touppercase, respectively.

{˜P ˜:P ˜@P ˜:@P}⊲ Plural. If argument eql 1 print nothing, otherwiseprint s; do the same for the previous argument; if ar-gument eql 1 print y, otherwise print ies; do the samefor the previous argument, respectively.

˜ [n 1 ] % ⊲ Newline. Print n newlines.

˜ [n 1 ] &⊲ Fresh-Line. Print n− 1 newlines if output stream isat the beginning of a line, or n newlines otherwise.

{˜ ˜: ˜@ ˜:@ }⊲ Conditional Newline. Print a newline likepprint-newline with argument :linear, :fill, :miser,or :mandatory, respectively.

{˜:← ˜@← ˜←}⊲ Ignored Newline. Ignore newline, or whitespace fol-lowing newline, or both, respectively.

˜ [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 fieldof 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.

36

Common Lisp Quick Reference

˜ [:] [@] <˘[prefix "" ˜;] [per-line-prefix ˜@;]

¯body

ˆ˜;

suffix ""

˜˜: [@] >

⊲ Logical Block. Act like pprint-logical-block using body

asFuformat control string on the elements of the list ar-

gument or, with @, on the remaining arguments, whichare extracted by pprint-pop. With :, prefix and suffix

default to ( and ). When closed by ˜:@>, spaces inbody are replaced with conditional newlines.

{˜ [n 0 ] i ˜ [n 0 ] :i}⊲ Indent. Set indentation to n relative to leftmost/tocurrent position.

˜ [c 1 ] [,i 1 ] [:] [@] T⊲ Tabulate. Move cursor forward to column numberc+ki, k ≥ 0 being as small as possible. With :, calculatecolumn numbers relative to the immediately enclosingsection. With @, move to column number c0 + c + kiwhere c0 is the current position.

{˜ [m 1 ] ∗ ˜ [m 1 ] :∗ ˜ [n 0 ] @∗}⊲ Go-To. Jump m arguments forward, or backward, orto argument n.

˜ [limit ] [:] [@] { text ˜}⊲ Iteration. Use text repeatedly, up to limit , as controlstring for the elements of the list argument or (with @)for the remaining arguments. With : or :@, list elementsor remaining arguments should be lists of which a newone is used at each iteration step.

˜ˆx

ˆ,y [,z ]

˜˜ˆ

⊲ Escape Upward. Leave immediately ˜< ˜>,

˜< ˜:>, ˜{ ˜}, ˜?, or the entireFuformat operation.

With one to three prefixes, act only if x = 0, x = y, orx ≤ y ≤ z, respectively.

˜ [i ] [:] [@] [ [{text ˜;}∗ text] [˜:; default ] ˜]⊲ Conditional Expression. Use the zero-indexed argu-menth (or ith if given) text as a

Fuformat control sub-

clause. With :, use the first text if the argument valueis NIL, or the second text if it is T. With @, do nothingfor an argument value of NIL. Use the only text andleave the argument to be read again if it is T.

˜ [@] ?⊲ Recursive Processing. Process two arguments as con-trol string and argument list. With @, take one ar-gument as control string and use then the rest of theoriginal arguments.

˜ˆprefix {,prefix}∗

˜[:] [@] /function/

⊲ Call Function. Call function with the argumentsstream, format-argument, colon-p, at-sign-p andprefixes for printing format-argument.

˜ [:] [@] W⊲ Write. Print argument of any type obeying everyprinter control variable. With :, pretty-print. With@, print without limits on length or depth.

{V #}⊲ In place of the comma-separated prefix parameters:use next argument or number of remaining unprocessedarguments, respectively.

37

Common Lisp Quick Reference

13.6 Streams

(Fuopen path

8>>>>>>>>>>>>>>>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>>>>>>>>>>>>>>>:

˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛˛

:direction

8>><>>:

:input:output:io:probe

9>>=>>;

:input

:element-type

type

:default

ffcharacter

:if-exists

8>>>>>>>>><>>>>>>>>>:

:new-version:error:rename:rename-and-delete:overwrite:append:supersedeNIL

9>>>>>>>>>=>>>>>>>>>;

:new-version if pathspecifies :newest;NIL otherwise

:if-does-not-exist

8<:

:error:createNIL

9=;NIL for :direction :probe;

{:create :error} otherwise

:external-format format :default

9>>>>>>>>>>>>>>>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;

)

⊲ Open file-stream to path .

(Fumake-concatenated-stream input-stream∗)

(Fumake-broadcast-stream output-stream∗)

(Fumake-two-way-stream input-stream-part output-stream-part)

(Fumake-echo-stream from-input-stream to-output-stream)

(Fumake-synonym-stream variable-bound-to-stream)

⊲ Return stream of indicated type.

(Fumake-string-input-stream string

ˆstart 0 [end NIL ]

˜)

⊲ Return a string-stream supplying the characters fromstring .

(Fumake-string-output-stream [:element-type type character ])

⊲ Return a string-stream accepting characters (available viaFuget-output-stream-string).

(Fuconcatenated-stream-streams concatenated-stream)

(Fubroadcast-stream-streams broadcast-stream )

⊲ Return list of streams concatenated-stream still has toread from/broadcast-stream is broadcasting to.

(Futwo-way-stream-input-stream two-way-stream)

(Futwo-way-stream-output-stream two-way-stream)

(Fuecho-stream-input-stream echo-stream)

(Fuecho-stream-output-stream echo-stream)

⊲ Return source stream or sink stream of two-way-stream/echo-stream , respectively.

(Fusynonym-stream-symbol synonym-stream)

⊲ Return symbol of synonym-stream.

(Fuget-output-stream-string ˜string-stream)

⊲ Clear and return as a string characters on string-stream.

(Fufile-position stream [

8<:

:start:endposition

9=;])

⊲ Return position within stream, or set it to position andreturn T on success.

(Fufile-string-length stream foo)

⊲ Length foo would have in stream .

(Fulisten [stream var

∗standard-input∗ ])

⊲ T if there is a character in input stream.

(Fuclear-input [stream var

∗standard-input∗ ])

⊲ Clear input from stream, return NIL.

(

8<:

Fuclear-outputFuforce-outputFufinish-output

9=; [stream var

∗standard-output∗ ])

⊲ End output to stream and return NIL immediately, afterinitiating flushing of buffers, or after flushing of buffers,respectively.

38

Common Lisp Quick Reference

(Fuclose stream [:abort bool NIL ])

⊲ Close stream . Return T if stream had been open. If :abortis T, delete associated file.

(Mwith-open-file (stream path open-arg∗) (declare ddecl∗)∗ form

P∗)⊲ Use

Fuopen with open-args to temporarily create stream to

path; return values of forms.

(Mwith-open-stream (foo stream) (declare ddecl∗)∗ form

P∗)⊲ Evaluate forms with foo locally bound to stream . Returnvalues of forms.

(Mwith-input-from-string (foo string

8<:

˛˛˛:index index

:start start 0:end end NIL

9=;) (declare

ddecl∗)∗ formP∗)

⊲ Evaluate forms with foo locally bound to inputstring-stream from string. Return values of forms; storenext reading position into index .

(Mwith-output-to-string (foo [string NIL ] [:element-type type character ])

(declare ddecl∗)∗ formP∗)

⊲ Evaluate forms with foo locally bound to an outputstring-stream. Append output to string and return valuesof forms if string is given. Return string containing outputotherwise.

(Fustream-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.

13.7 Pathnames and Files

(Fumake-pathname8

>>>>>>>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>>>>>>>:

˛˛˛˛˛˛˛˛˛˛˛˛˛˛

:host {host NIL :unspecific}:device {device NIL :unspecific}

:directory

8>>>>>><>>>>>>:

{directory :wild NIL :unspecific}

(

:absolute:relative

ff8>>><>>>:

directory

:wild:wild-inferiors:up:back

9>>>=>>>;

)

:name {file-name :wild NIL :unspecific}:type {file-type :wild NIL :unspecific}:version {:newest version :wild NIL :unspecific}:defaults path host from

var∗default-pathname-defaults∗

:case {:local :common} :local

9>>>>>>>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>>>>>>>;

)

⊲ Construct pathname. For :case :local, leave case of com-ponents unchanged. For :case :common, leave mixed-casecomponents unchanged; convert all-uppercase componentsinto local customary case; do the opposite with all-lowercasecomponents.

(

8>>><>>>:

Fupathname-hostFupathname-deviceFupathname-directoryFupathname-nameFupathname-type

9>>>=>>>;

path [:case

:local:common

ff:local ])

(Fupathname-version path)

⊲ Return pathname component.

(Fuparse-namestring foo

ˆhostˆ

default-pathname var∗default-pathname-defaults∗

39

Common Lisp Quick Reference

8<:

˛˛˛:start start 0:end end NIL

:junk-allowed bool NIL

9=;

˜˜)

⊲ Return pathname converted from string, pathname, orstream foo; and

2position where parsing stopped.

(Fumerge-pathnames pathnameˆ

default-pathname var∗default-pathname-defaults∗

[default-version :newest ]˜)

⊲ Return pathname after filling in missing componentsfrom default-pathname .

var∗default-pathname-defaults∗

⊲ Pathname to use if one is needed and none supplied.

(Fuuser-homedir-pathname [host ]) ⊲ User’s home directory.

(Fuenough-namestring path [root-path var

∗default-pathname-defaults∗ ])

⊲ Return minimal path string to sufficiently describe path

relative to root-path.

(Funamestring path)

(Fufile-namestring path)

(Fudirectory-namestring path)

(Fuhost-namestring path)

⊲ Return string representing full pathname; name, type,and version; directory name; or host name, respectively, ofpath .

(Futranslate-pathname path wildcard-path-a wildcard-path-b)

⊲ Translate path from wildcard-path-a into wildcard-path-b .Return new path.

(Fupathname path) ⊲ Pathname of path.

(Fulogical-pathname logical-path)

⊲ Logical pathname of logical-path . Logical pathnames are

represented as all-uppercase #P"[host:][:]{{dir *}+**

ff;}∗

{name *}∗ˆ.

{type *}+LISP

ff[.{version * newest NEWEST}]

˜".

(Fulogical-pathname-translations logical-host)

⊲ List of (from-wildcard to-wildcard) translations forlogical-host . setfable.

(Fuload-logical-pathname-translations logical-host)

⊲ Load logical-host ’s translations. Return NIL if alreadyloaded; return T if successful.

(Futranslate-logical-pathname pathname)

⊲ Physical pathname corresponding to (possibly logical)pathname .

(Fuprobe-file file)

(Futruename file)

⊲ Canonical name of file. If file does not exist, returnNIL/signal file-error, respectively.

(Fufile-write-date file) ⊲ Time at which file was last written.

(Fufile-author file) ⊲ Return name of file owner.

(Fufile-length stream) ⊲ Return length of stream .

(Furename-file foo bar)

⊲ Rename file foo to bar . Unspecified components of pathbar default to those of foo. Return new pathname,

2old

physical file name, and3new physical file name.

(Fudelete-file file) ⊲ Delete file. Return T.

(Fudirectory path) ⊲ List of pathnames matching path .

(Fuensure-directories-exist path [:verbose bool ])

⊲ Create parts of path if necessary. Second return value is

2T if something has been created.

40

Common Lisp Quick Reference

14 Packages and Symbols

14.1 Predicates

(Fusymbolp foo)

(Fupackagep foo)

(Fukeywordp foo)

⊲ T if foo is of indicated type.

14.2 Packages

:bar keyword:bar ⊲ Keyword, evaluates to :bar .

package:symbol ⊲ Exported symbol of package .

package::symbol ⊲ Possibly unexported symbol of package .

(Mdefpackage foo

8>>>>>>>>>>><>>>>>>>>>>>:

˛˛˛˛˛˛˛˛˛

(:nicknames nick∗)∗

(:documentation string)(:intern interned-symbol∗)∗

(:use used-package∗)∗

(:import-from pkg imported-symbol∗)∗

(:shadowing-import-from pkg shd-symbol∗)∗

(:shadow shd-symbol∗)∗

(:export exported-symbol∗)∗

(:size int)

9>>>>>>>>>>>=>>>>>>>>>>>;

)

⊲ Create or modify package foo with interned-symbols,symbols from used-packages, imported-symbols, andshd-symbols. Add shd-symbols to foo’s shadowing list.

(Fumake-package foo

˛:nicknames (nick∗)NIL:use (used-package∗)

ff)

⊲ Create package foo .

(Furename-package package new-name [new-nicknames NIL ])

⊲ Rename package . Return renamed package.

(Min-package cfoo) ⊲ Make package foo current.

(

Fuuse-packageFuunuse-package

ffother-packages [package var

∗package∗ ])

⊲ Make exported symbols of other-packages available inpackage, or remove them from package , respectively. Re-turn T.

(Fupackage-use-list package)

(Fupackage-used-by-list package)

⊲ List of other packages used by/using package .

(Fudelete-package ˜package)

⊲ Delete package . Return T if successful.

var∗package∗common-lisp-user ⊲ The current package.

(Fulist-all-packages) ⊲ List of registered packages.

(Fupackage-name package) ⊲ Name of package .

(Fupackage-nicknames package) ⊲ List of nicknames of package .

(Fufind-package name) ⊲ Package with name (case-sensitive).

(Fufind-all-symbols foo)

⊲ List of symbols foo from all registered packages.

(

FuinternFufind-symbol

fffoo [package var

∗package∗ ])

⊲ Intern or find, respectively, symbol foo in package . Sec-ond return value is one of

2:internal,

2:external, or

2:inherited

(or2NIL if

Fuintern created a fresh symbol).

(Fuunintern symbol [package var

∗package∗ ])

⊲ Remove symbol from package , return T on success.

(

FuimportFushadowing-import

ffsymbols [package var

∗package∗ ])

⊲ Make symbols internal to package. Return T. In case ofa name conflict signal correctable package-error or shadowthe old symbol, respectively.

41

Common Lisp Quick Reference

(Fushadow symbols [package var

∗package∗ ])

⊲ Make symbols of package shadow any otherwise accessi-ble, equally named symbols from other packages. ReturnT.

(Fupackage-shadowing-symbols package)

⊲ List of symbols of package that shadow any otherwiseaccessible, equally named symbols from other packages.

(Fuexport symbols [package var

∗package∗ ])

⊲ Make symbols external to package . Return T.

(Fuunexport symbols [package var

∗package∗ ])

⊲ Revert symbols to internal status. Return T.

(

8<:

Mdo-symbolsMdo-external-symbols

ff(dvar

ˆpackage var

∗package∗ [result NIL ]˜)

Mdo-all-symbols (var [result NIL ])

9=;

(declare ddecl∗)∗

˛ ctagform

ff∗)

⊲ EvaluatesOtagbody-like body with var successively bound

to every symbol from package , to every external symbolfrom package , or to every symbol from all registered pack-ages, respectively. Return values of result . Implicitly, thewhole form is a

sOblock named NIL.

(Mwith-package-iterator (foo packages [:internal :external :inherited])

(declare ddecl∗)∗ formP∗)

⊲ Return values of forms. In forms, successive invocationsof (foo) return: T if a symbol is returned; a symbol frompackages; accessibility (:internal, :external, or :inherited);and the package the symbol belongs to.

(Furequire module [paths NIL ])

⊲ If not invar

∗modules∗, try paths to load module from. Sig-nal error if unsuccessful. Deprecated.

(Fuprovide module)

⊲ If not already there, add module tovar

∗modules∗. Depre-cated.

var∗modules∗ ⊲ List of names of loaded modules.

14.3 Symbols

A symbol has the attributes name , home package, property list, andoptionally value (of global constant or variable name) and function(function, macro, or special operator name).

(Fumake-symbol name)

⊲ Make fresh, uninterned symbol name .

(Fugensym [s G ])

⊲ Return fresh, uninterned symbol #:sn with n fromvar

∗gensym-counter∗. Incrementvar

∗gensym-counter∗.

(Fugentemp

ˆprefix T [package var

∗package∗ ]˜)

⊲ Intern fresh symbol in package. Deprecated.

(Fucopy-symbol symbol [props NIL ])

⊲ Return uninterned copy of symbol . If props is T, givecopy the same value, function and property list.

(Fusymbol-name symbol)

(Fusymbol-package symbol)

(Fusymbol-plist symbol)

(Fusymbol-value symbol)

(Fusymbol-function symbol)

⊲ Name, package, property list, value, or function, respec-tively, of symbol . setfable.

(

gFdocumentation(setf

gFdocumentation) new-doc

fffoo

8>><>>:

’variable ’function’compiler-macro’method-combination

’structure ’type ’setf T

9>>=>>;

)

⊲ Get/set documentation string of foo of given type.

42

Common Lisp Quick Reference

cot

⊲ Truth; the supertype of every type including t; the su-perclass of every class except t;

var∗terminal-io∗.

conil

co()

⊲ Falsity; the empty list; the empty type, subtype of ev-ery type;

var∗standard-input∗;

var∗standard-output∗; the global

environment.

14.4 Standard Packages

common-lisp cl⊲ Exports the defined names of Common Lisp except forthose in the keyword package.

common-lisp-user cl-user⊲ Current package after startup; uses package common-lisp.

keyword⊲ Contains symbols which are defined to be of typekeyword.

15 Compiler

15.1 Predicates

(Fuspecial-operator-p foo) ⊲ T if foo is a special operator.

(Fucompiled-function-p foo)

⊲ T if foo is of type compiled-function.

15.2 Compilation

(Fucompile

8<:NIL definitionname

(setf name)

ff[definition ]

9=;)

⊲ Return compiled function or replace name ’s function def-inition with the compiled function. Return

2T in case of

warnings or errors, and3T in case of warnings or errors ex-

cluding style warnings.

(Fucompile-file file

8>><>>:

˛˛˛˛

:output-file out-path

:verbose bool var∗compile-verbose∗

:print bool var∗compile-print∗

:external-format file-format :default

9>>=>>;

)

⊲ Write compiled contents of file to out-path . Return trueoutput path or NIL,

2T in case of warnings or errors,

3T in case

of warnings or errors excluding style warnings.

(Fucompile-file-pathname file [:output-file path ] [other-keyargs])

⊲ PathnameFucompile-file writes to if invoked with the same

arguments.

(Fuload path

8>><>>:

˛˛˛˛

:verbose bool var∗load-verbose∗

:print bool var∗load-print∗

:if-does-not-exist bool T:external-format file-format :default

9>>=>>;

)

⊲ Load source file or compiled file into Lisp environment.Return T if successful.

var∗compile-file

var∗load

ff-

pathname∗NIL

truename∗NIL

⊲ Input file used byFucompile-file/by

Fuload.

var∗compile

var∗load

ff-

print∗verbose∗

⊲ Defaults used byFucompile-file/by

Fuload.

(sOeval-when (

8<:

˛˛˛{:compile-toplevel compile}{:load-toplevel load}{:execute eval}

9=;) form

P∗)

⊲ Return values of forms ifsOeval-when is in the top-level of a

file being compiled, in the top-level of a compiled file beingloaded, or anywhere, respectively. Return NIL if forms arenot evaluated. (compile, load and eval deprecated.)

43

Common Lisp Quick Reference

(sOlocally (declare ddecl∗)∗ form

P∗)⊲ Evaluate forms in a lexical environment with declarationsdecl in effect. Return values of forms.

(Mwith-compilation-unit ([:override bool NIL ]) form

P∗)⊲ Return values of forms. Warnings deferred by the com-piler until end of compilation are deferred until the end ofevaluation of forms.

(sOload-time-value form [ read-only NIL ])

⊲ Evaluate form at compile time and treat its value as lit-eral at run time.

(sOquote cfoo) ⊲ Return unevaluated foo.

(gFmake-load-form foo [environment ])

⊲ Its methods are to return a creation form which on eval-uation at

Fuload time returns an object equivalent to foo, and

an optional2initialization form which on evaluation performs

some initialization of the object.

(Fumake-load-form-saving-slots foo

˛:slot-names slots all local slots

:environment environment

ff)

⊲ Return a creation form and an2initialization form which

on evaluation construct an object equivalent to foo withslots initialized with the corresponding values from foo.

(Fumacro-function symbol [environment ])

(Fucompiler-macro-function

name

(setf name)

ff[environment ])

⊲ Return specified macro function, or compiler macro func-tion, respectively, if any. Return NIL otherwise. setfable.

(Fueval arg)

⊲ Return values of value of arg evaluated in global environ-ment.

15.3 REPL and Debuggingvar+

var++

var+++

var∗

var∗∗

var∗∗∗

var/

var//

var///⊲ Last, penultimate, or antepenultimate form evaluatedin the REPL, or their respective primary value, or a list oftheir respective values.

var– ⊲ Form currently being evaluated by the REPL.

(Fuapropos string [package NIL ])

⊲ Print interned symbols containing string.

(Fuapropos-list string [package NIL ])

⊲ List of interned symbols containing string .

(Fudribble [path ])

⊲ Save a record of interactive session to file at path . With-out path, close that file.

(Fued [file-or-function NIL ]) ⊲ Invoke editor if possible.

(

Fumacroexpand-1Fumacroexpand

ffform [environment NIL ])

⊲ Return macro expansion, once or entirely, respectively,of form and

2T if form was a macro form. Return form and

2NIL otherwise.

var∗macroexpand-hook∗

⊲ Function of arguments expansion function, macro form,and environment called by

Fumacroexpand-1 to generate

macro expansions.

(Mtrace

function

(setf function)

ff∗)

⊲ Cause functions to be traced. With no arguments, returnlist of traced functions.

44

Common Lisp Quick Reference

(Muntrace

function

(setf function)

ff∗)

⊲ Stop functions, or each currently traced function, frombeing traced.

var∗trace-output∗

⊲ StreamMtrace and

Mtime print their output on.

(Mstep form)

⊲ Step through evaluation of form. Return values of form .

(Fubreak [control arg∗])

⊲ Jump directly into debugger; return NIL. See p. 35,Fuformat, for control and args.

(Mtime form)

⊲ Evaluate forms and print timing information tovar

∗trace-output∗. Return values of form .

(Fuinspect foo) ⊲ Interactively give information about foo.

(Fudescribe foo [stream var

∗standard-output∗ ])

⊲ Send information about foo to stream.

(gFdescribe-object foo [stream])

⊲ Send information about foo to stream . Not to be calledby user.

(Fudisassemble function)

⊲ Send disassembled representation of function tovar

∗standard-output∗. Return NIL.

15.4 Declarations

(Fuproclaim decl)

(Mdeclaim ddecl∗)

⊲ Globally make declaration(s) decl . decl can be:declaration, type, ftype, inline, notinline, optimize, orspecial. See below.

(declare ddecl∗)⊲ 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.

(dynamic-extent variable∗ (sOfunction function)∗)

⊲ Declare lifetime of variables and/or functions to endwhen control leaves enclosing block.

([type] type variable∗)(ftype type function∗)

⊲ Declare variables or functions to be of type.

(

ignorableignore

ff var

(sOfunction function)

ff∗)

⊲ 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.

(optimize

8>>>><>>>>:

˛˛˛˛˛

compilation-speed (compilation-speed n 3 )

debug (debug n 3 )

safety (safety n 3 )

space (space n 3 )

speed (speed n 3 )

9>>>>=>>>>;

)

⊲ Tell compiler how to optimize. n = 0 means unim-portant, n = 1 is neutral, n = 3 means important.

(special var∗) ⊲ Declare vars to be dynamic.

45

Common Lisp Quick Reference

16 External Environment

(Fuget-internal-real-time)

(Fuget-internal-run-time)

⊲ Current time, or computing time, respectively, in clockticks.

cointernal-time-units-per-second

⊲ Number of clock ticks per second.

(Fuencode-universal-time sec min hour date month year [zone curr ])

(Fuget-universal-time)

⊲ Seconds from 1900-01-01, 00:00, ignoring leap seconds.

(Fudecode-universal-time universal-time [time-zone current ])

(Fuget-decoded-time)

⊲ Return second,2minute,

3hour,

4date,

5month,

6year,

7day,

8daylight-p, and

9zone.

(Furoom [{NIL :default T}])

⊲ Print information about internal storage management.

(Fushort-site-name)

(Fulong-site-name)

⊲ String representing physical location of computer.

(

8<:

Fulisp-implementationFusoftwareFumachine

9=;-

typeversion

ff)

⊲ Name or version of implementation, operating system, orhardware, respectively.

(Fumachine-instance) ⊲ Computer name.

46

Common Lisp Quick Reference

Index” 32’ 32( 32() 43) 32∗ 3, 29, 30, 40, 44∗∗ 40, 44∗∗∗ 44∗BREAK-

ON-SIGNALS∗ 29∗COMPILE-FILE-

PATHNAME∗ 43∗COMPILE-FILE-

TRUENAME∗ 43∗COMPILE-PRINT∗ 43∗COMPILE-

VERBOSE∗ 43∗DEBUG-IO∗ 39∗DEBUGGER-HOOK∗

29∗DEFAULT-

PATHNAME-DEFAULTS∗ 40

∗ERROR-OUTPUT∗ 39∗FEATURES∗ 33∗GENSYM-

COUNTER∗ 42∗LOAD-PATHNAME∗

43∗LOAD-PRINT∗ 43∗LOAD-TRUENAME∗

43∗LOAD-VERBOSE∗ 43∗MACROEXPAND-

HOOK∗ 44∗MODULES∗ 42∗PACKAGE∗ 41∗PRINT-ARRAY∗ 35∗PRINT-BASE∗ 35∗PRINT-CASE∗ 35∗PRINT-CIRCLE∗ 35∗PRINT-ESCAPE∗ 35∗PRINT-GENSYM∗ 35∗PRINT-LENGTH∗ 35∗PRINT-LEVEL∗ 35∗PRINT-LINES∗ 35∗PRINT-

MISER-WIDTH∗ 35∗PRINT-PPRINT-

DISPATCH∗ 35∗PRINT-PRETTY∗ 35∗PRINT-RADIX∗ 35∗PRINT-READABLY∗

35∗PRINT-RIGHT-

MARGIN∗ 35∗QUERY-IO∗ 39∗RANDOM-STATE∗ 4∗READ-BASE∗ 32∗READ-DEFAULT-

FLOAT-FORMAT∗

32∗READ-EVAL∗ 33∗READ-SUPPRESS∗32∗READTABLE∗ 32∗STANDARD-INPUT∗

39∗STANDARD-

OUTPUT∗ 39∗TERMINAL-IO∗ 39∗TRACE-OUTPUT∗ 45+ 3, 26, 44++ 44+++ 44, 32,. 32,@ 32– 3, 44. 32/ 3, 33, 44// 44/// 44/= 3: 41:: 41:ALLOW-

OTHER-KEYS 19; 32< 3<= 3= 3, 21> 3>= 3\ 33# 37#\ 32#’ 33#( 33#∗ 33#+ 33#– 33#. 33#: 33#< 33#= 33#A 33#B 32#C( 33#O 32#P 33#R 32#S( 33#X 32## 33#| |# 32

&ALLOW-OTHER-KEYS 19

&AUX 19&BODY 19&ENVIRONMENT 19&KEY 19&OPTIONAL 19&REST 19&WHOLE 19∼( ∼) 36∼∗ 37∼/ / 37∼< ∼:> 37∼< ∼> 36∼? 37∼A 36∼B 36∼C 36∼D 36∼E 36∼F 36∼G 36∼I 37∼O 36∼P 36∼R 36∼S 36∼T 37∼W 37∼X 36∼[ ∼] 37∼$ 36∼% 36∼& 36∼ˆ 37∼ 36∼| 36∼{ ∼} 37∼∼ 36∼← 36` 32| | 331+ 31– 3

ABORT 28ABOVE 21ABS 4ACONS 9ACOS 3ACOSH 4ACROSS 21ADD-METHOD 25ADJOIN 9ADJUST-ARRAY 10ADJUSTABLE-

ARRAY-P 10ALLOCATE-INSTANCE

24ALPHA-CHAR-P 6ALPHANUMERICP 6ALWAYS 23AND 19, 21, 26, 29, 33APPEND 9, 23, 26APPENDING 23APPLY 17APROPOS 44APROPOS-LIST 44AREF 10ARITHMETIC-ERROR

30ARITHMETIC-ERROR-

OPERANDS 28ARITHMETIC-ERROR-

OPERATION 28ARRAY 30ARRAY-DIMENSION 11ARRAY-DIMENSION-

LIMIT 11ARRAY-DIMENSIONS

11ARRAY-

DISPLACEMENT 11ARRAY-

ELEMENT-TYPE 29ARRAY-HAS-

FILL-POINTER-P 10ARRAY-IN-BOUNDS-P

10ARRAY-RANK 11ARRAY-RANK-LIMIT

11ARRAY-ROW-

MAJOR-INDEX 11ARRAY-TOTAL-SIZE

11ARRAY-TOTAL-

SIZE-LIMIT 11ARRAYP 10AS 21ASH 5ASIN 3ASINH 4ASSERT 27ASSOC 9ASSOC-IF 9ASSOC-IF-NOT 9ATAN 3ATANH 4ATOM 8, 30

BASE-CHAR 30BASE-STRING 30BEING 21BELOW 21

BIGNUM 30BIT 11, 30BIT-AND 11BIT-ANDC1 11BIT-ANDC2 11BIT-EQV 11BIT-IOR 11BIT-NAND 11BIT-NOR 11BIT-NOT 11BIT-ORC1 11BIT-ORC2 11BIT-VECTOR 30BIT-VECTOR-P 10BIT-XOR 11BLOCK 20BOOLE 4BOOLE-1 4BOOLE-2 4BOOLE-AND 5BOOLE-ANDC1 5BOOLE-ANDC2 5BOOLE-C1 4BOOLE-C2 4BOOLE-CLR 4BOOLE-EQV 4BOOLE-IOR 5BOOLE-NAND 5BOOLE-NOR 5BOOLE-ORC1 5BOOLE-ORC2 5BOOLE-SET 4BOOLE-XOR 5BOOLEAN 30BOTH-CASE-P 6BOUNDP 15BREAK 45BROADCAST-

STREAM 30BROADCAST-

STREAM-STREAMS38

BUILT-IN-CLASS 30BUTLAST 9BY 21BYTE 5BYTE-POSITION 5BYTE-SIZE 5

CAAR 8CADR 8CALL-ARGUMENTS-

LIMIT 17CALL-METHOD 26CALL-NEXT-METHOD

25CAR 8CASE 19CATCH 20CCASE 19CDAR 8CDDR 8CDR 8CEILING 4CELL-ERROR 30CELL-ERROR-NAME

28CERROR 27CHANGE-CLASS 24CHAR 8CHAR-CODE 7CHAR-CODE-LIMIT 7CHAR-DOWNCASE 7CHAR-EQUAL 6CHAR-GREATERP 7CHAR-INT 7CHAR-LESSP 7CHAR-NAME 7CHAR-NOT-EQUAL 6CHAR-

NOT-GREATERP 7CHAR-NOT-LESSP 7CHAR-UPCASE 7CHAR/= 6CHAR< 6CHAR<= 6CHAR= 6CHAR> 6CHAR>= 6CHARACTER 7, 30, 32CHARACTERP 6CHECK-TYPE 29CIS 4CL 43CL-USER 43CLASS 30CLASS-NAME 24CLASS-OF 24CLEAR-INPUT 38CLEAR-OUTPUT 38CLOSE 39CLQR 1CLRHASH 14CODE-CHAR 7COERCE 29COLLECT 23COLLECTING 23COMMON-LISP 43COMMON-LISP-USER

43COMPILATION-SPEED

45COMPILE 43COMPILE-FILE 43

COMPILE-FILE-PATHNAME 43

COMPILED-FUNCTION 30

COMPILED-FUNCTION-P 43

COMPILER-MACRO 42COMPILER-MACRO-

FUNCTION 44COMPLEMENT 17COMPLEX 4, 30, 33COMPLEXP 3COMPUTE-

APPLICABLE-METHODS 25

COMPUTE-RESTARTS28

CONCATENATE 12CONCATENATED-

STREAM 30CONCATENATED-

STREAM-STREAMS38

COND 19CONDITION 30CONJUGATE 4CONS 8, 30CONSP 8CONSTANTLY 17CONSTANTP 15CONTINUE 28CONTROL-ERROR 30COPY-ALIST 9COPY-LIST 9COPY-PPRINT-

DISPATCH 35COPY-READTABLE 32COPY-SEQ 14COPY-STRUCTURE 15COPY-SYMBOL 42COPY-TREE 10COS 3COSH 3COUNT 12, 23COUNT-IF 12COUNT-IF-NOT 12COUNTING 23CTYPECASE 29

DEBUG 45DECF 3DECLAIM 45DECLARATION 45DECLARE 45DECODE-FLOAT 6DECODE-UNIVERSAL-

TIME 46DEFCLASS 23DEFCONSTANT 16DEFGENERIC 24DEFINE-COMPILER-

MACRO 18DEFINE-CONDITION

27DEFINE-METHOD-

COMBINATION 26DEFINE-MODIFY-

MACRO 19DEFINE-SETF-

EXPANDER 18DEFINE-SYMBOL-

MACRO 18DEFMACRO 18DEFMETHOD 25DEFPACKAGE 41DEFPARAMETER 16DEFSETF 18DEFSTRUCT 15DEFTYPE 29DEFUN 17DEFVAR 16DELETE 13DELETE-DUPLICATES

13DELETE-FILE 40DELETE-IF 13DELETE-IF-NOT 13DELETE-PACKAGE 41DENOMINATOR 4DEPOSIT-FIELD 5DESCRIBE 45DESCRIBE-OBJECT 45DESTRUCTURING-

BIND 20DIGIT-CHAR 7DIGIT-CHAR-P 6DIRECTORY 40DIRECTORY-

NAMESTRING 40DISASSEMBLE 45DIVISION-BY-ZERO 30DO 20, 21DO-ALL-SYMBOLS 42DO-EXTERNAL-

SYMBOLS 42DO-SYMBOLS 42DO∗ 20DOCUMENTATION 42DOING 21DOLIST 21DOTIMES 20DOUBLE-FLOAT 30, 33DOUBLE-

FLOAT-EPSILON 6

47

Common Lisp Quick Reference

DOUBLE-FLOAT-NEGATIVE-EPSILON6

DOWNFROM 21DOWNTO 21DPB 5DRIBBLE 44DYNAMIC-EXTENT 45

EACH 21ECASE 19ECHO-STREAM 30ECHO-STREAM-

INPUT-STREAM 38ECHO-STREAM-

OUTPUT-STREAM38

ED 44EIGHTH 8ELSE 21ELT 12ENCODE-UNIVERSAL-

TIME 46END 21END-OF-FILE 30ENDP 8ENOUGH-

NAMESTRING 40ENSURE-

DIRECTORIES-EXIST 40

ENSURE-GENERIC-FUNCTION 25

EQ 15EQL 15, 29EQUAL 15EQUALP 15ERROR 27, 30ETYPECASE 29EVAL 44EVAL-WHEN 43EVENP 3EVERY 12EXP 3EXPORT 42EXPT 3EXTENDED-CHAR 30EXTERNAL-SYMBOL

21EXTERNAL-SYMBOLS

21

FBOUNDP 16FCEILING 4FDEFINITION 17FFLOOR 4FIFTH 8FILE-AUTHOR 40FILE-ERROR 30FILE-ERROR-

PATHNAME 28FILE-LENGTH 40FILE-NAMESTRING 40FILE-POSITION 38FILE-STREAM 30FILE-STRING-LENGTH

38FILE-WRITE-DATE 40FILL 12FILL-POINTER 11FINALLY 23FIND 13FIND-ALL-SYMBOLS

41FIND-CLASS 24FIND-IF 13FIND-IF-NOT 13FIND-METHOD 25FIND-PACKAGE 41FIND-RESTART 28FIND-SYMBOL 41FINISH-OUTPUT 38FIRST 8FIXNUM 30FLET 17FLOAT 4, 30FLOAT-DIGITS 6FLOAT-PRECISION 6FLOAT-RADIX 6FLOAT-SIGN 4FLOATING-

POINT-INEXACT 30FLOATING-

POINT-INVALID-OPERATION 30

FLOATING-POINT-OVERFLOW 30

FLOATING-POINT-UNDERFLOW 30

FLOATP 3FLOOR 4FMAKUNBOUND 17FOR 21FORCE-OUTPUT 38FORMAT 35FORMATTER 35FOURTH 8FRESH-LINE 33FROM 21FROUND 4FTRUNCATE 4FTYPE 45FUNCALL 17FUNCTION

17, 30, 33, 42FUNCTION-

KEYWORDS 26

FUNCTION-LAMBDA-EXPRESSION 17

FUNCTIONP 15

GCD 3GENERIC-FUNCTION

30GENSYM 42GENTEMP 42GET 16GET-DECODED-TIME

46GET-

DISPATCH-MACRO-CHARACTER 32

GET-INTERNAL-REAL-TIME 46

GET-INTERNAL-RUN-TIME 46

GET-MACRO-CHARACTER 32

GET-OUTPUT-STREAM-STRING 38

GET-PROPERTIES 16GET-SETF-

EXPANSION 19GET-UNIVERSAL-

TIME 46GETF 16GETHASH 14GO 20GRAPHIC-CHAR-P 6

HANDLER-BIND 27HANDLER-CASE 27HASH-KEY 21HASH-KEYS 21HASH-TABLE 30HASH-TABLE-COUNT

14HASH-TABLE-P 14HASH-TABLE-

REHASH-SIZE 14HASH-

TABLE-REHASH-THRESHOLD 14

HASH-TABLE-SIZE 14HASH-TABLE-TEST 14HASH-VALUE 21HASH-VALUES 21HOST-NAMESTRING

40

IDENTITY 17IF 19, 21IGNORABLE 45IGNORE 45IGNORE-ERRORS 27IMAGPART 4IMPORT 41IN 21IN-PACKAGE 41INCF 3INITIALIZE-INSTANCE

24INITIALLY 23INLINE 45INPUT-STREAM-P 31INSPECT 45INTEGER 30INTEGER-

DECODE-FLOAT 6INTEGER-LENGTH 5INTEGERP 3INTERACTIVE-

STREAM-P 31INTERN 41INTERNAL-

TIME-UNITS-PER-SECOND 46

INTERSECTION 10INTO 23INVALID-METHOD-

ERROR 25INVOKE-DEBUGGER

27INVOKE-RESTART 28INVOKE-RESTART-

INTERACTIVELY 28ISQRT 3IT 21, 23

KEYWORD 30, 41, 43KEYWORDP 41

LABELS 17LAMBDA 17LAMBDA-LIST-

KEYWORDS 19LAMBDA-

PARAMETERS-LIMIT 17

LAST 8LCM 3LDB 5LDB-TEST 5LDIFF 9LEAST-NEGATIVE-

DOUBLE-FLOAT 6LEAST-NEGATIVE-

LONG-FLOAT 6LEAST-NEGATIVE-

NORMALIZED-DOUBLE-FLOAT 6

LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT 6

LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT 6

LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT 6

LEAST-NEGATIVE-SHORT-FLOAT 6

LEAST-NEGATIVE-SINGLE-FLOAT 6

LEAST-POSITIVE-DOUBLE-FLOAT 6

LEAST-POSITIVE-LONG-FLOAT 6

LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT 6

LEAST-POSITIVE-NORMALIZED-LONG-FLOAT 6

LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT 6

LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT 6

LEAST-POSITIVE-SHORT-FLOAT 6

LEAST-POSITIVE-SINGLE-FLOAT 6

LENGTH 12LET 20LET∗ 20LISP-

IMPLEMENTATION-TYPE 46

LISP-IMPLEMENTATION-VERSION 46

LIST 8, 26, 30LIST-ALL-PACKAGES

41LIST-LENGTH 8LIST∗ 8LISTEN 38LISTP 8LOAD 43LOAD-LOGICAL-

PATHNAME-TRANSLATIONS 40

LOAD-TIME-VALUE 44LOCALLY 44LOG 3LOGAND 5LOGANDC1 5LOGANDC2 5LOGBITP 5LOGCOUNT 5LOGEQV 5LOGICAL-PATHNAME

30, 40LOGICAL-PATHNAME-

TRANSLATIONS 40LOGIOR 5LOGNAND 5LOGNOR 5LOGNOT 5LOGORC1 5LOGORC2 5LOGTEST 5LOGXOR 5LONG-FLOAT 30, 33LONG-

FLOAT-EPSILON 6LONG-FLOAT-

NEGATIVE-EPSILON6

LONG-SITE-NAME 46LOOP 21LOOP-FINISH 23LOWER-CASE-P 6

MACHINE-INSTANCE46

MACHINE-TYPE 46MACHINE-VERSION 46MACRO-FUNCTION 44MACROEXPAND 44MACROEXPAND-1 44MACROLET 18MAKE-ARRAY 10MAKE-BROADCAST-

STREAM 38MAKE-

CONCATENATED-STREAM 38

MAKE-CONDITION 27MAKE-

DISPATCH-MACRO-CHARACTER 32

MAKE-ECHO-STREAM 38

MAKE-HASH-TABLE14

MAKE-INSTANCE 24MAKE-INSTANCES-

OBSOLETE 24MAKE-LIST 8MAKE-LOAD-FORM 44MAKE-LOAD-FORM-

SAVING-SLOTS 44MAKE-METHOD 26MAKE-PACKAGE 41MAKE-PATHNAME 39MAKE-

RANDOM-STATE 4MAKE-SEQUENCE 12MAKE-STRING 7

MAKE-STRING-INPUT-STREAM 38

MAKE-STRING-OUTPUT-STREAM38

MAKE-SYMBOL 42MAKE-SYNONYM-

STREAM 38MAKE-TWO-

WAY-STREAM 38MAKUNBOUND 16MAP 14MAP-INTO 14MAPC 9MAPCAN 9MAPCAR 9MAPCON 9MAPHASH 14MAPL 9MAPLIST 9MASK-FIELD 5MAX 4, 26MAXIMIZE 23MAXIMIZING 23MEMBER 8, 29MEMBER-IF 8MEMBER-IF-NOT 8MERGE 12MERGE-PATHNAMES

40METHOD 30METHOD-

COMBINATION30, 42

METHOD-COMBINATION-ERROR 25

METHOD-QUALIFIERS 26

MIN 4, 26MINIMIZE 23MINIMIZING 23MINUSP 3MISMATCH 12MOD 4, 29MOST-NEGATIVE-

DOUBLE-FLOAT 6MOST-NEGATIVE-

FIXNUM 6MOST-NEGATIVE-

LONG-FLOAT 6MOST-NEGATIVE-

SHORT-FLOAT 6MOST-NEGATIVE-

SINGLE-FLOAT 6MOST-POSITIVE-

DOUBLE-FLOAT 6MOST-POSITIVE-

FIXNUM 6MOST-POSITIVE-

LONG-FLOAT 6MOST-POSITIVE-

SHORT-FLOAT 6MOST-POSITIVE-

SINGLE-FLOAT 6MUFFLE-WARNING 28MULTIPLE-

VALUE-BIND 20MULTIPLE-

VALUE-CALL 17MULTIPLE-

VALUE-LIST 17MULTIPLE-

VALUE-PROG1 19MULTIPLE-

VALUE-SETQ 16MULTIPLE-

VALUES-LIMIT 17

NAME-CHAR 7NAMED 21NAMESTRING 40NBUTLAST 9NCONC 9, 23, 26NCONCING 23NEVER 23NEWLINE 6NEXT-METHOD-P 24NIL 2, 43NINTERSECTION 10NINTH 8NO-APPLICABLE-

METHOD 25NO-NEXT-METHOD

25NOT 15, 29, 33NOTANY 12NOTEVERY 12NOTINLINE 45NRECONC 9NREVERSE 12NSET-DIFFERENCE 10NSET-EXCLUSIVE-OR

10NSTRING-CAPITALIZE

7NSTRING-DOWNCASE

7NSTRING-UPCASE 7NSUBLIS 10NSUBST 10NSUBST-IF 10NSUBST-IF-NOT 10NSUBSTITUTE 13NSUBSTITUTE-IF 13NSUBSTITUTE-

IF-NOT 13NTH 8NTH-VALUE 17

48

Common Lisp Quick Reference

NTHCDR 8NULL 8, 30NUMBER 30NUMBERP 3NUMERATOR 4NUNION 10

ODDP 3OF 21OF-TYPE 21ON 21OPEN 38OPEN-STREAM-P 31OPTIMIZE 45OR 19, 26, 29, 33OTHERWISE 19, 29OUTPUT-STREAM-P

31

PACKAGE 30PACKAGE-ERROR 30PACKAGE-ERROR-

PACKAGE 28PACKAGE-NAME 41PACKAGE-

NICKNAMES 41PACKAGE-

SHADOWING-SYMBOLS 42

PACKAGE-USE-LIST 41PACKAGE-

USED-BY-LIST 41PACKAGEP 41PAIRLIS 9PARSE-ERROR 30PARSE-INTEGER 8PARSE-NAMESTRING

39PATHNAME 30, 40PATHNAME-DEVICE

39PATHNAME-

DIRECTORY 39PATHNAME-HOST 39PATHNAME-MATCH-P

31PATHNAME-NAME 39PATHNAME-TYPE 39PATHNAME-VERSION

39PATHNAMEP 31PEEK-CHAR 31PHASE 4PI 3PLUSP 3POP 9POSITION 13POSITION-IF 13POSITION-IF-NOT 13PPRINT 33PPRINT-DISPATCH 35PPRINT-EXIT-IF-LIST-

EXHAUSTED 34PPRINT-FILL 34PPRINT-INDENT 34PPRINT-LINEAR 34PPRINT-LOGICAL-

BLOCK 34PPRINT-NEWLINE 35PPRINT-POP 34PPRINT-TAB 34PPRINT-TABULAR 34PRESENT-SYMBOL 21PRESENT-SYMBOLS

21PRIN1 33PRIN1-TO-STRING 33PRINC 33PRINC-TO-STRING 33PRINT 33PRINT-

NOT-READABLE 30PRINT-

NOT-READABLE-OBJECT 28

PRINT-OBJECT 33PRINT-UNREADABLE-

OBJECT 33PROBE-FILE 40PROCLAIM 45PROG 20PROG1 19PROG2 19PROG∗ 20PROGN 19, 26PROGRAM-ERROR 30PROGV 20PROVIDE 42PSETF 16PSETQ 16PUSH 9PUSHNEW 9

QUOTE 32, 44

RANDOM 4RANDOM-STATE 30RANDOM-STATE-P 3RASSOC 9RASSOC-IF 9RASSOC-IF-NOT 9RATIO 30, 33RATIONAL 4, 30RATIONALIZE 4RATIONALP 3READ 31READ-BYTE 31READ-CHAR 31

READ-CHAR-NO-HANG 31

READ-DELIMITED-LIST 31

READ-FROM-STRING31

READ-LINE 31READ-PRESERVING-

WHITESPACE 31READ-SEQUENCE 32READER-ERROR 30READTABLE 30READTABLE-CASE 32READTABLEP 31REAL 30REALP 3REALPART 4REDUCE 14REINITIALIZE-

INSTANCE 24REM 4REMF 16REMHASH 14REMOVE 13REMOVE-

DUPLICATES 13REMOVE-IF 13REMOVE-IF-NOT 13REMOVE-METHOD 25REMPROP 16RENAME-FILE 40RENAME-PACKAGE 41REPEAT 23REPLACE 13REQUIRE 42REST 8RESTART 30RESTART-BIND 28RESTART-CASE 28RESTART-NAME 28RETURN 20, 21RETURN-FROM 20REVAPPEND 9REVERSE 12ROOM 46ROTATEF 16ROUND 4ROW-MAJOR-AREF 10RPLACA 9RPLACD 9

SAFETY 45SATISFIES 29SBIT 11SCALE-FLOAT 6SCHAR 8SEARCH 13SECOND 8SEQUENCE 30SERIOUS-CONDITION

30SET 16SET-DIFFERENCE 10SET-

DISPATCH-MACRO-CHARACTER 32

SET-EXCLUSIVE-OR10

SET-MACRO-CHARACTER 32

SET-PPRINT-DISPATCH 35

SET-SYNTAX-FROM-CHAR 32

SETF 16, 42SETQ 16SEVENTH 8SHADOW 42SHADOWING-IMPORT

41SHARED-INITIALIZE

24SHIFTF 16SHORT-FLOAT 30, 33SHORT-

FLOAT-EPSILON 6SHORT-FLOAT-

NEGATIVE-EPSILON6

SHORT-SITE-NAME 46SIGNAL 27SIGNED-BYTE 30SIGNUM 4SIMPLE-ARRAY 30SIMPLE-BASE-STRING

30SIMPLE-BIT-VECTOR

30SIMPLE-

BIT-VECTOR-P 10SIMPLE-CONDITION

30SIMPLE-CONDITION-

FORMAT-ARGUMENTS 29

SIMPLE-CONDITION-FORMAT-CONTROL29

SIMPLE-ERROR 30SIMPLE-STRING 30SIMPLE-STRING-P 7SIMPLE-TYPE-ERROR

30SIMPLE-VECTOR 30SIMPLE-VECTOR-P 10SIMPLE-WARNING 30SIN 3SINGLE-FLOAT 30, 33SINGLE-

FLOAT-EPSILON 6

SINGLE-FLOAT-NEGATIVE-EPSILON6

SINH 3SIXTH 8SLEEP 20SLOT-BOUNDP 23SLOT-EXISTS-P 23SLOT-MAKUNBOUND

24SLOT-MISSING 24SLOT-UNBOUND 24SLOT-VALUE 24SOFTWARE-TYPE 46SOFTWARE-VERSION

46SOME 12SORT 12SPACE 6, 45SPECIAL 45SPECIAL-

OPERATOR-P 43SPEED 45SQRT 3STABLE-SORT 12STANDARD 26STANDARD-CHAR

6, 30STANDARD-CHAR-P 6STANDARD-CLASS 30STANDARD-GENERIC-

FUNCTION 30STANDARD-METHOD

30STANDARD-OBJECT

30STEP 45STORAGE-

CONDITION 30STORE-VALUE 28STREAM 30STREAM-

ELEMENT-TYPE 29STREAM-ERROR 30STREAM-

ERROR-STREAM 28STREAM-EXTERNAL-

FORMAT 39STREAMP 31STRING 7, 30STRING-CAPITALIZE 7STRING-DOWNCASE 7STRING-EQUAL 7STRING-GREATERP 7STRING-LEFT-TRIM 7STRING-LESSP 7STRING-NOT-EQUAL7STRING-

NOT-GREATERP 7STRING-NOT-LESSP 7STRING-RIGHT-TRIM

7STRING-STREAM 30STRING-TRIM 7STRING-UPCASE 7STRING/= 7STRING< 7STRING<= 7STRING= 7STRING> 7STRING>= 7STRINGP 7STRUCTURE 42STRUCTURE-CLASS

30STRUCTURE-OBJECT

30STYLE-WARNING 30SUBLIS 10SUBSEQ 12SUBSETP 8SUBST 10SUBST-IF 10SUBST-IF-NOT 10SUBSTITUTE 13SUBSTITUTE-IF 13SUBSTITUTE-IF-NOT

13SUBTYPEP 29SUM 23SUMMING 23SVREF 11SXHASH 14SYMBOL 21, 30, 42SYMBOL-FUNCTION

42SYMBOL-MACROLET

18SYMBOL-NAME 42SYMBOL-PACKAGE 42SYMBOL-PLIST 42SYMBOL-VALUE 42SYMBOLP 41SYMBOLS 21SYNONYM-STREAM

30SYNONYM-STREAM-

SYMBOL 38

T 2, 30, 43TAGBODY 20TAILP 8TAN 3TANH 3TENTH 8TERPRI 33THE 21, 29THEN 21THEREIS 23THIRD 8

THROW 20TIME 45TO 21TRACE 44TRANSLATE-

LOGICAL-PATHNAME 40

TRANSLATE-PATHNAME 40

TREE-EQUAL 10TRUENAME 40TRUNCATE 4TWO-WAY-STREAM

30TWO-WAY-STREAM-

INPUT-STREAM 38TWO-WAY-STREAM-

OUTPUT-STREAM38

TYPE 42, 45TYPE-ERROR 30TYPE-ERROR-DATUM

29TYPE-ERROR-

EXPECTED-TYPE29TYPE-OF 29TYPECASE 29TYPEP 29

UNBOUND-SLOT 30UNBOUND-

SLOT-INSTANCE 28UNBOUND-VARIABLE

30UNDEFINED-

FUNCTION 30UNEXPORT 42UNINTERN 41UNION 10UNLESS 19, 21UNREAD-CHAR 31UNSIGNED-BYTE 30UNTIL 23UNTRACE 45UNUSE-PACKAGE 41UNWIND-PROTECT 20UPDATE-INSTANCE-

FOR-DIFFERENT-CLASS 24

UPDATE-INSTANCE-FOR-REDEFINED-CLASS 24

UPFROM 21UPGRADED-ARRAY-

ELEMENT-TYPE 29UPGRADED-

COMPLEX-PART-TYPE 6

UPPER-CASE-P 6UPTO 21USE-PACKAGE 41USE-VALUE 28USER-HOMEDIR-

PATHNAME 40USING 21

V 37VALUES 17, 29VALUES-LIST 17VARIABLE 42VECTOR 11, 30VECTOR-POP 11VECTOR-PUSH 11VECTOR-

PUSH-EXTEND 11VECTORP 10

WARN 27WARNING 30WHEN 19, 21WHILE 23WILD-PATHNAME-P

31WITH 21WITH-ACCESSORS 24WITH-COMPILATION-

UNIT 44WITH-CONDITION-

RESTARTS 28WITH-HASH-TABLE-

ITERATOR 14WITH-INPUT-

FROM-STRING 39WITH-OPEN-FILE 39WITH-OPEN-STREAM

39WITH-OUTPUT-

TO-STRING 39WITH-PACKAGE-

ITERATOR 42WITH-SIMPLE-

RESTART 28WITH-SLOTS 24WITH-STANDARD-

IO-SYNTAX 31WRITE 34WRITE-BYTE 34WRITE-CHAR 34WRITE-LINE 34WRITE-SEQUENCE 34WRITE-STRING 34WRITE-TO-STRING 34

Y-OR-N-P 31YES-OR-NO-P 31

ZEROP 3

49

clCommon Lisp Quick Reference Revision 123 [2011-01-09]

Copyright © 2008, 2009, 2010, 2011 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