Course Grades Email
Welcome
Policies Grades Inc Intgrty Preface Part I Chap 1 Chap 2 Chap 3 XEmacs Chap 4 Chap 5 Chap 6 Chap 7 Chap 8 Chap 9 Part II Chap 10 Chap 11 Chap 12 Chap 13 Chap 14 Chap 15 Chap 16 Chap 17 Chap 18 Chap 19 Chap 20 Chap 21 Chap 22 Chap 23 Part III Chap 24 Chap 25 Chap 26 Chap 27 Chap 28 Chap 29 Chap 30 Chap 31 Chap 32 | CHAPTER 16: RECURSION ON LISTS, PART 1---ANALYSIS - Corrections
-
- page 101, lines -6 - -3: Change
> (in-package 'ch16) #<Package CH16 60227265> > (shadow 'length) T to > (defpackage ch16 (:shadow length)) #<The CH16 package> > :pa ch16 > - page 102, line -3: Change
'() to nil - Notes
-
- Read Chapter 16
- Do the exercises of this chapter in the
ch16 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 Appendix A. - Do Exercise 16.7 if you feel it would help.
- Do Exercises 16.8 and 16.9. The
time function introduced in Exercise 16.9 can be very useful in developing large systems. - 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
nth and 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
match.cl file. 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 appropriate defpackage and in-package forms.), and it should have definitions of two functions: - The function
count as 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 monthNumber : CH16(58): (monthNumber 'April) 4 CH16(59): (monthNumber 'December) 12 CH16(60): (monthNumber 'Adar) NIL - When you've sumbitted correct Exercises through this chapter, you will have earned a grade of C-.
|