The Department of Computer Science & Engineering  # COMMON LISP: An Interactive Approach by Stuart C. Shapiro Published by Computer Science Press An Imprint of W. H. Freeman and Company New York, 1992 ERRATA

Preface

Part I
Chapter 4
Part II
Chapter 13
Chapter 16
Chapter 17
Chapter 18
Chapter 19
Chapter 21
Chapter 22
Chapter 23
Part III
Chapter 24
Chapter 25
Chapter 28
Chapter 29
Chapter 30
Chapter 32
Part IV
Chapter 33
Chapter 34
Part V
Appendix A
Appendix B
Index

Preface
Page xviii, line 3: Change This to It.

Part I
Chapter 4
• Page 21, line -6: Change
```
> (+ 12 4) 16
```
to
```
> (+ 12 4)
16
```
• Page 21, line -1: Move line to top of page 22.

• Page 26, line -3: Change (25 + 30) × 15/2 to (25 + 30) × (15/2)

Part II
Chapter 13
• Page 85, line 16: Change function to number.

Chapter 16
• Page 102, line -3: Change '() to nil.

Chapter 17
• Page 121, line -13: Change ((+ 3 5) - 6 * 8)) to ((+ 3 5) - 6 * 8).
• Page 121, line -7: Change combine-expression to enclose-expression.

Chapter 18
• Page 130, lines 1 - 7: Change indentation from
```
(defun bstreep (tree)
"A bstree is either an element, or a three-member list,
the first of which is an element."
(or (typep tree 'util:element)
(and (listp tree)
(= (length tree) 3)
(typep (first tree) 'util:element))))
```
to
```
(defun bstreep (tree)
"A bstree is either an element, or a three-member list,
the first of which is an element."
(or (typep tree 'util:element)
(and (listp tree)
(= (length tree) 3)
(typep (first tree) 'util:element))))
```

Chapter 19
• Page 143, line 17: Change using backquote to using the backquote.

• Page 145, Exercise 19.2: Change the numbering from
1. (eval 5)
2. (eval a)
3. (eval 'a)
4. (eval ''a)
5. (eval (first (a))) (eval (first '(a)))
6. (eval '(first (a)))
7. (eval '(first '(a)))
8. (eval (cons 'first '((a))))
9. (eval (cons 'first '('(a))))
to
1. (eval 5)
2. (eval a)
3. (eval 'a)
4. (eval ''a)
5. (eval (first (a)))
6. (eval (first '(a)))
7. (eval '(first (a)))
8. (eval '(first '(a)))
9. (eval (cons 'first '((a))))
10. (eval (cons 'first '('(a))))

• Page 147, line -1: Change on to in.

Chapter 21
• Page 153, lines 8 - 16: Change the indentation from
```
"VECTOR is a list of numbers.
Returns a list just like it,
except that each number in it is incremented by 1."
(check-type vector list)
(typecase vector
(null '())
(cons (cons (1+ (first vector))
```
to
```
"VECTOR is a list of numbers.
Returns a list just like it,
except that each number in it is incremented by 1."
(check-type vector list)
(typecase vector
(null '())
(cons (cons (1+ (first vector))
```

• Page 154, line -8: Change scalar-add1, then, is to scalar-add1 is.

Chapter 22
• Page 160, line 9: Change \&rest to &rest.
• Page 161, line -13: Change LISP's to LISP.

Chapter 23
• Page 171, line -9: Change (macroexpand '(pluslist-f (+ 3 4) 5)) to (macroexpand '(pluslist-m (+ 3 4) 5)).

Part III
Chapter 24
• Page 176, lines 17-21: Change two instances of 2.6931471806d0 to 2.7182817.
• Page 176, line -8: Insert a little space betweem symbol and 's.

Chapter 25
• Page 184, line -1: Change (setq x 3) to (setf x 3).

Chapter 28
• Page 207, line 10: Change 12))) to 12)).
• Page 207, line 17: Change forms to statements.
• Page 207, line 18: Change form to statement.
• Page 210, line -1: Change list:dolist to lisp:dolist.

Chapter 29
• Page 217, line 13: Change evaluate form to evaluate a form.
• Page 225, line -10: Change (format t " &I heard you say    A " sentence) to (format t "~&I heard you say ~{~A~}" sentence).

Chapter 30
• Page 238, line 15: Change 30.18 Define to 30.18 (i) Define.
• Page 238, line -4: Change 'numberp to #'numberp.

Chapter 32
• Page 248, line 1: Change can be any list to can be any LISP.

Part IV
Chapter 33
• Page 260, line -6: Change the generic method to the generic function.

• Page 262, lines 1 - 7: Move line 7 up, changing
```
> (defmethod < ((x number) (y number))
(lisp:< x y))
> (< 3 5)
T
> (< 5 3)
NIL
#<method (TICLOS:METHOD < (NUMBER NUMBER))>
```
to
```
> (defmethod < ((x number) (y number))
(lisp:< x y))
#<method (TICLOS:METHOD < (NUMBER NUMBER))>
> (< 3 5)
T
> (< 5 3)
NIL
```

• Page 262, line 8: Change generic method to generic function.

Chapter 34
• Page 280, line 20: Change (princ '__) to (princ '__ stream).

Part V
Appendix A
• Page 297, lines 1 - 11: Change
```
17.34 (defun enclose-expression (expr)
"EXPR is a list representing an arithmetic
expression (using only the operators + and -)
in normal infix notation.
Returns a list whose one member is EXPR
transformed into Cambridge Prefix Notation."
(check-type expr list)
(cond ((< (length expr) 3) expr)
(t (combine-expr
(second expr) (first expr)
(enclose-expression (nthcdr 2 expr))))))
```
to
```
17.34 (defun enclose-expression (expr)
"EXPR is a list representing an arithmetic
expression (using only the operators + and -)
in normal infix notation.
Returns a list whose one member is EXPR transformed
into Cambridge Prefix Notation."
(check-type expr list)
(cond ((< (length expr) 3) expr)
(t (enclose-expression
(combine-expr
(second expr) (first expr) (nthcdr 2 expr))))))
```

• Page 298, lines 15 - 18: Change
```
(defun lhs (rule)
"Returns the right-hand side of the RULE."
(check-type rule rule)
(first rule))
```
to
```
(defun lhs (rule)
"Returns the left-hand side of the RULE."
(check-type rule rule)
(first rule))
```

• Page 304, lines 13 - 28: Change
```
(defun substitute (pat subs)
"Returns a tree like PAT,
but with every variable that is bound in
the substitution SUBS
replaced by the term it is bound to."
(check-type subs list)
(cond ((atom pat)
(if (and (variablep pat) (boundp pat subs))
(bound-to pat subs)
pat))
((and (svariablep (first pat))
(boundp (first pat) subs))
(append (bound-to (first pat) subs)
(substitute (rest pat) subs)))
(t (cons (substitute (first pat) subs)
(substitute (rest pat) subs)))))
```
to
```
(defun substitute (pat subs)
"Returns a tree like PAT,
but with every variable that is bound in
the substitution SUBS
replaced by the term it is bound to."
;; pat cannot be a sequence variable because there might be no
;; environment to splice its value into.
(check-type pat (not (satisfies svariablep)))
(check-type subs list)
(cond ((atom pat)
(if (and (variablep pat) (boundp pat subs))
(bound-to pat subs)
pat))
((and (svariablep (first pat))
(boundp (first pat) subs))
(append (bound-to (first pat) subs)
(substitute (rest pat) subs)))
(t (cons (substitute (first pat) subs)
(substitute (rest
pat) subs)))))
```

• Page 310, lines 7 - 13: Change
```
33.5 (defmethod < ((x t) (y t))
(check-type x
(or character number symbol string))
(check-type x
(or character number symbol string))
(member (type-of y)
(member
(type-of x)
'(character number symbol string))))
```
to
```
33.5 (defmethod < ((x t) (y t))
(check-type x
(or character number symbol string))
(check-type x
(or character number symbol string))
(member (gentype-of y)
(member
(gentype-of x)
'(character number symbol string))))

(defun gentype-of (o)
"Returns the general type of the object O."
(typecase o
(character 'character)
(number 'number)
(symbol 'symbol)
(string 'string)))
```

Appendix B
• Page 316, lines -15 - -11: Move 1 line down to change

(let* ( {symbol | (symbol form)}*)special form
[(declare (special variables))]
forms)
Exactly like let except that the assigning of initial values
to the variables is done in order so that one variable may be used
in the initialization form of a later variable.

to

(let* ( {symbol | (symbol form)}*)special form
[(declare (special variables))]
forms)

Exactly like let except that the assigning of initial values to the
variables is done in order so that one variable may be used in the
initialization form of a later variable.

• Page 317, lines -6 - -4: Change font of four symbols from tt font to italics font, changing

((objects1) forms1)
...
((objectsn) formsn))

to

((objects1) forms1)
...
((objectsn) formsn))

• Page 318, line 2: Change font of objectsn to objectsn.

• Page 318, line 17: Change font of four symbols from tt to italics, changing
(typecase form (type1 forms1) ... (typen formsn))
to
(typecase form (type1 forms1) ... (typen formsn))

• Page 319, lines 1-2: Insert a new one-line paragraph:
In these three macros, a statement is a non-atomic (that is, a list) form.

• Page 319, lines 2-16: Change seven (7) occurrences of the plural italic forms to statements.

• Page 329, line 1: Change tt #'eql to #'eql.

• Page 331, line -9: Change #'eql to #'eql.

• Page 335, line -8: Change the font of objects to objects.

• Page 335, line -5: Change the font of objects to objects.

• Page 336, lines 2 - -8: Change the font of eight (8) occurrences of object and of one occurrence of objects to objects.

• Page 345: Add, as new entry:

(ed [symbol])function
Invokes the editor. If symbol is included, tries to let you edit
where it is defined into the editor. This function might not be
implemented.

Index
• Page 350, column 1, line 5: Insert a page number, changing
defvar, 176, 342
to
defvar, 176, 188, 342.

• Page 350, column 1, line -7: Insert a page number, changing
ed, 244
to
ed, 244, 345

• Page 351, column 1, line -6: Insert a page number, changing
directives, 221, 222
to
directives, 221, 222, 226

• Page 353, column 1, line -6: Change
McCarthy, John, 21
to
McCarthy, John, 22

Thanks to J. Terry Nutter for significant contributions to this list.

Stuart C. Shapiro <shapiro@cse.buffalo.edu>
UNIVERSITY AT BUFFALO | SHAPIRO'S COMMON LISP | PUBLISHER'S COMMON LISP | COMPUTER SCIENCE PRESS | W. H. FREEMAN | 