# Errata as of February 17, 2001

## subst

The third Checkpoint question should specify that the procedure is given the number of ml of wine and the number of ml per bottle.

## decide

The phrase "volume factor" really refers to the volume discount.

The deliverables requests ``observations about the rules and definitions for procedures". This is an error and should be ignored.

## rrsp

When the After the Lab question asks for ``tax benefits'', it looks for the difference between the balances of the two accounts at the end of the term.

## fibonaci

Question 3 in After the Lab should mention fast-fib-helper instead of fast-fib.

Question 5 in After the Lab should read "...(and are avoided in fast-fib) ..." and not "...(and are avoided in fib)..." as it currently does.

## crypt

``table-enencrypt-twice'' should be ``encrypt-twice'' in Checkpoint, 2.

## strinrep lab

The first Checkpoint question should refer to (make-time-24 13 1 2), not (make-time 24 13 1 2). The lab has:
> (time->12string breakfast)
"7:30:00 am"
but it should have
> (time->12string breakfast)
"07:30:00 am"
The hour should take two digits.

There is only one string input procedure: string->time, but it requires several helpers.

## grate

Checkpoint question 2 is in error:
(define joel
(lambda (x y)
(letrec
((help
(lambda (a b c)
(if (> a b) a (help (* c a) b))))))
(help x y 2)))
This is buggy. The following is better:
(define joel
(lambda (x y)
(letrec
((help
(lambda (a b c)
(if (> a b) a (help (* c a) b c)))))
(help x y 2))))

## cartesian

The lab mentions "the attached note": the descriptions of the graphics procedures are in the text.

The lab mentions the square root procedure in the Deliverables. There is no need to write a square root procedure.

In Checkpoint question 2, instead of having the helper count up from 0, it is easier if factorial checks for n being 0 and then calls the helper to count up from 1.

Checkpoint part 3: cube-root *doesn't* have to check whether its argument is positive or negative, whereas fourth-root does.

## Shape

(define house
(lambda (dr mv)
...
Well, it should be (lambda (mv dr) ... if you want it to be consistent with the other graphical procs in the lab.

## Box

In the third Checkpoint question, (navigate '((1 2) (1 2 (3))) '(d 1 a 1 d1)) should be (navigate '((1 2) (1 2 (3))) '(d 1 a 1 d 1)).

## game

In the sidebar on Random Numbers, "random-picture" should be "random sequence". Deliverables "a listing OF the module"

## phone

• (the-customer 'map-calls cost-of-a-call) should have been (customer-map the-customer cost-of-a-call).
• perceived ambiguity (but a careful reading of the description on p. 55 shows there is no ambiguity): the out-of-area discount is given if the total cost of all calls (including those to the subscriber's area code) is > \$25.00. In-area calls are included.
• it would be better to include the cost per minute in the bill (the lab doesn't ask for this).
• the listing for Ruth Chandler on p. 55 assumes a rate to area code 808 of 50 cents per minute, but on the next page an example shows the cost as 35 cents per minute.
• minor ambiguity on top of p. 55 (1st para): `calls should be listed in order...'. There is no intention that students sort data (though you can ask them to do this by inserting call records into the list in the right order). The intention here was to put a constraint on the input ordering.

## Picture

the lab is unclear about whether a random picture should have a random number of commands. The signature indicates that it is a fixed number, while earlier the lab states that there should be a random number. Either interpretation is satisfactory, but you should make clear which you wish.

The lab will probably be amended to say in the random-picture command: {number} is the number of commands in the picture. It outputs a random picture with a MAXIMUM of number commands

## Turtle

The After the Lab question mentions the subpicture command in the picture language lab, which the students may not have done.

In ``Before the lab", the code example omits a quote on ice-cream-bar . It should be:
> (define ice-cream-bar
(make-meltable-thing 'ice-cream-bar 2)
The lab neglects to show that (clock) returns ().

In the late homework question, to find out how to get jim to have the homework, without getting you upset, you must read the person class to find out how to change the objects owned by a person.

## further

The dialog about the pizzeria should be corrected as follows:
?? (current-position)
pizzeria
?? (look-around)
== ok
?? (look-around)
luigi says -- Your pizza is available for pickup.
?? (look-around)
pizza
== ok
The commands are not enclosed in parentheses in the text.

The text shows the person with the pizza groveling. This is unnecessary since the person can give the pizza. The person should offer the pizza, lose it, and return it as the value of the grovel message. Then the troll can take the pizza, which removes it from the place. The dialog should be:

grendel moved from lair to clock-tower.
grendel  says -- Hssss--s!  I'm going to eat you, tommy!!
grendel says -- Grovel, you low-on-the-food-chain human!
grendel took pizza
grendel says  --  OK, thanks for not putting any anchovies on it!
The text mentions computer-lab, which should be cs-lab to agree with the "Adventures in Objectland" lab.

The examples use the word ``dungeon" while the text uses the word ``lair" to refer to the troll's quarters. The ``Deanery" mentioned in the lab is the same as the Dean's office.

## network

substring-of should be substring-of?, since it is a predicate.

The class cl-host has a method account that returns a cl-account object.

The class cl-account has a method id that returns the user id of the user currently logged in.

The class cl-wrapper transmits name to the file-server object rather than block the message.

After the host is created, it must be initialized:

(define host1 (cl-host 'make 'host1 fs1))
(host1 'init host1)
In cl-account, the method files does not return a list of file objects, as the documentation claims, but rather an association list where the car of each pair the name of the file and the cdr is the file object itself.

File servers must also be initialized:

(define fs1 (cl-file-server 'make ...))
(fs1 `init fs1)

## morenet

When the lab explains how to manipulate email, it should say (host1 'run 'mail-exe 'list-letters), not (host1 'wrapper 'mail-exe 'list-letters).

In deliver-mail

((cdr (assv from-server (box-alist-ref file-servers)))
'sendmail email))
should be
((cdr to-server) 'sendmail email))
In cl-host, the wrapper method should be:
((wrapper)
(if (not account)
(error (list name message) "No user at the moment")
(let ((name (car args))
(wrapper (env 'get-variable 'wrapper)))
(if (eqv? 'run name)
(apply wrapper (cons (car args) (cons env (cdr args))))
(apply wrapper args)))))))
In this way, public programs on the host will cause the wrapper to receive a run message, like run, and will not be confused with services like sendmail.
• The last line in remove-alist-help should be
(cons (car alist) (remove-alist-help (cdr alist) key))))))

In the ftp question, you don't have to alter the procedure do-ftp. Just provide the services it needs.

## oodraw

"that shows what happens when you Scheme evaluates the sequence" should be "that shows what happens when Scheme evaluates the sequence"

## ebnf

(with-input-from-file "code.ebnf" (define rules (inrules)))
should be
(set! rules (with-input-from-file "code.ebnf" (lambda () (inrules))))

In After the Lab: gen-info should be gen-ebnf.

## Trees

"The trees should check every condition described in the specification." should be "The TESTS should check every condition described in the specification."

The lab mentions a procedure evaluate-cell; it should be evaluate-sheet.

## Meter

(define-class meter
(constructor proc)

should be
(define-class meter
(constructor-arguments proc)

In the signature for number-of-comparisons, the third element in the inputs should be "compare is a comparison procedure".

The student will have to write make-sorted-list, and generate-sorted-lists, and generate-random-lists. These are not described in the Deliverables but are part of the work and should be handed in.

## Math assistant

find-zero cannot find a zero when the value of the function is the same sign at both ends. The example (find-zero square -1.0 1.0 0.001) should instead be (find-zero (* x (* x x)) -1.0 1.0 0.001), which has a zero-crossing at 0.

The lab never tells the student that the formula can contain operations, forms, as well as the name of formulas. The solution presented here uses a translate procedure to produce a formula with no references to any defined symbols. It is based on deep-map from Chapter 4 (in the text) as a starting point. The lab doesn't tell students about it.