|CHAPTER 16: RECURSION ON LISTS, PART 1---ANALYSIS
- page 101, lines -6 - -3: Change
> (in-package 'ch16)
#<Package CH16 60227265>
> (shadow 'length)
> (defpackage ch16
#<The CH16 package>
> :pa ch16
- page 102, line -3: Change
- Read Chapter 16
- Do the exercises of this chapter in the
package, as instructed.
- Do Exercises 16.1 and 16.2
- Do Exercise 16.3. Use
check-type from now on
whenever it is appropriate.
- Do Exercises 16.4 and 16.5. Be sure to note what
lisp:member returns, as discussed in Exercise 16.5.
- Load your
util file, and do Exercise 16.6.
Compare your definition of
before with the one in
- Do Exercise 16.7 if you feel it would help.
- Do Exercises 16.8 and 16.9. The
introduced in Exercise 16.9 can be very useful in developing large
- Do Exercise 16.11. Compare your definition of
equal-lelt with the one in Appendix A. This exercise is
particularly important if you are doing Project P1.
- You needn't do Exercises 16.12 or 16.13, but do try out
nthcdr so you might remember them if
they might be useful in the future.
- You needn't do Exercise 16.14, but think about how you would
do it, and then look at the definition in Appendix A. Lispers often
use an association list in the form of a list of two element
lists in order to associate the second member of each sublist with the
first. It is like an array, except that any Lisp element can be used
as the index, and it is searched serially instead of randomly. For
example, an association list of people's telephone extensions might be
'((Stu 125) (Bill 112) (Deb 116) (Carl 115))
- Do Exercise 16.15, and submit the revised
Please remember to revise the line "This file satisfies the exercises
through Exercise ???"
Also please note that
matchlelt should return
NIL if one argument list runs out before the other (i.e.,
if the two lists are of different lengths).
- Submit a file named
ch16.cl. This file should have its
code in the
ch16 package (It should start with
forms.), and it should have definitions of two functions:
- The function
specified in Exercise 16.10.
- The function
monthNumber which should take a symbol that looks like a
month, spelled normally, and return the number of that month. If the
argument is not a valid month (or not even a symbol),
monthNumber should return
NIL. You should
use the function
assoc and a quoted association list.
(See Exercise 16.14, and the discussion of it above.) Here are some
example uses of a correct
CH16(58): (monthNumber 'April)
CH16(59): (monthNumber 'December)
CH16(60): (monthNumber 'Adar)
- When you've sumbitted correct Exercises through this chapter,
you will have earned a grade of C-.