TSPL3 Errata
Second Printing
Page 60 (reported by the author):
The phrase "which should return" in the description of the incorrect version of and should read, simply, "should return."
Page 85 (reported by Eduardo Cavazos):
A close parenthesis should appear after "See Chapter 8" in the first paragraph of Section 4.1.
Page 85 (reported by Eduardo Cavazos):
The phrase "a part of a that" in
it is not an error for such a variable reference to appear within a part of a that has not been evaluated
should read "a part of a program that."
Page 138 (reported by Magnus Persson):
(count-occurrences 'a '(a b c d a))
should read
(count-occurrences 'a '(a b c d a)) 2
Page 231 (reported by Magnus Persson): The let expression that defines dofmt and assigns printf and fprintf should be proceded by definitions for printf and fprintf:
(define printf #f)
(define fprintf #f)
Page 269 (reported by Sérgio Queiroz de Medeiros):
((lambda (t) (if t t (list x))) (or (memv x '(a b c))))
in the third line of the Exercise 3.1.2 answer should read as follows.
((lambda (t) (if t t (or (list x)))) (memv x '(a b c)))
First Printing
Page 6 (reported by the author):
The text that reads
Identifiers normally cannot start with any character that may start a number, i.e., a digit, plus sign ( + ), minus sign ( - ), or decimal point ( . ).
should read as follows.
Identifiers cannot start with an at sign ( @ ) and normally cannot start with any character that may start a number, i.e., a digit, plus sign ( + ), minus sign ( - ), or decimal point ( . ).
Page 49 (reported by Johannes Brauer, Gary Kopp, David J. Neu):
(let ((secret 0))
(set! shhh
(lambda (message)
(set! secret message)))
(set! tell
(lambda ()
message)))
should read
(let ((secret 0))
(set! shhh
(lambda (message)
(set! secret message)))
(set! tell
(lambda ()
secret)))
Page 60 (reported by William Byrd):
(define-syntax and ; incorrect!
(syntax-rules ()
((_) #t)
((_ e1 e2 e3 ...)
(if e1 (and e2 e3 ...) #f))))
should read
(define-syntax and ; incorrect!
(syntax-rules ()
((_) #t)
((_ e1 e2 ...)
(if e1 (and e2 ...) #f))))
Page 61 (reported by William Byrd):
(define-syntax or
(syntax-rules ()
((_) #f)
((_ e1 e2 e3 ...)
(let ((t e1))
(if t t (or e2 e3 ...))))))
should read
(define-syntax or ; incorrect!
(syntax-rules ()
((_) #f)
((_ e1 e2 ...)
(let ((t e1))
(if t t (or e2 ...))))))
Page 92 (reported by the author):
The word "using" in
Assignments are also using for caching values.
should be "useful."
Page 106 (reported by William Byrd):
(let ((x 'a))
(let ((f (lambda () x)))
(cons (call/cc
(lambda (k)
(fluid-let ((x 'b))
(f))))
(f)))) (b . a)
should read
(let ((x 'a))
(let ((f (lambda () x)))
(cons (call/cc
(lambda (k)
(fluid-let ((x 'b))
(k (f)))))
(f)))) (b . a)
Page 116 (reported by William Byrd):
(define cons 'not-cons)
(eval '(let ((x 3)) (cons x 4))
(scheme-report-environment 5)) (x . 4)
should read
(define cons 'not-cons)
(eval '(let ((x 3)) (cons x 4))
(scheme-report-environment 5)) (3 . 4)
Page 152 (reported by Kyle Blocher):
In the description of atan,
(lambda (x y) (angle (make-rectangular x y)))
should read as follows.
(lambda (y x) (angle (make-rectangular x y)))
That is, the y value is the first argument.
Page 171 (reported by Abdulaziz Ghuloum):
(input-port? '(a b c))) unspecified
should read
(input-port? '(a b c))) #f
Page 175 (reported by Abdulaziz Ghuloum):
(output-port? '(a b c))) unspecified
should read
(output-port? '(a b c))) #f
Page 185 (reported by the author):
The text starting with with "It must be possible," on the first line of this page and ending with the second code display should be replaced with the following.
The expander processes the initial forms in a lambda or other body from left to right. If it encounters a variable definition, it records the fact that the defined identifier is a variable but defers expansion of the right-hand-side expression until after all of the definitions have been processed. If it encounters a keyword definition, it expands and evaluates the right-hand-side expression and binds the keyword to the resulting transformer. If it encounters an expression, it fully expands all deferred right-hand-side expressions along with the current and remaining body expressions.
An implication of the left-to-right processing order is that one internal definition can affect whether a subsequent form is also a definition. For example, the expression
(let ()
(define-syntax bind-to-zero
(syntax-rules ()
((_ id) (define id 0))))
(bind-to-zero x)
x)
evaluates to 0, regardless of any binding for bind-to-zero that might appear outside of the let expression.
Page 188 (reported by Per Bothner):
In the bullet item that reads:
- P is of the form (P1 ... Pk Pe ellipsis Pm+1 ... Pn . Px), where ellipsis is the identifier ... and F is a list or improper list of n or more elements whose first k elements match P1 through Pk, whose next m - k elements each match Pe, whose next n - m elements match Pm+1 through Pn, and whose nth cdr matches Px,
"n or more" should read, "n," and "nth cdr" should read "nth and final cdr," i.e.,
- P is of the form (P1 ... Pk Pe ellipsis Pm+1 ... Pn . Px), where ellipsis is the identifier ... and F is a list or improper list of n elements whose first k elements match P1 through Pk, whose next m - k elements each match Pe, whose next n - m elements match Pm+1 through Pn, and whose nth and final cdr matches Px,
Page 270 (reported by the author):
The second "second" in
While the number of calls made by the second is directly proportional to the input, the number of calls made by the second grows rapidly (exponentially, in fact) as the input value increases.
should be "first."
Page 279 (reported by the author):
<initial> | <letter> | ! | @ | $ | % | & | * | / | : | < | = | > | ? | ~ | _ | ^ | |
<subsequent> | <initial> | <digit> | . | + | - |
should read
<initial> | <letter> | ! | $ | % | & | * | / | : | < | = | > | ? | ~ | _ | ^ | |
<subsequent> | <initial> | <digit> | . | + | - | @ |
That is, @ should be a <subsequent> rather than an <initial>.