The Department of Computer Science & Engineering
 STUART C. SHAPIRO: CSE 202

# CSE202:Programming in Lisp

 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 15: RECURSION Notes Read Chapter 15 Be sure you do the exercises of this chapter in the package `ch15` Do Exercises 15.1 - 15.3 Do Exercise 15.4. You may have to use quite a large number, and you may have to wait awhile before the error occurs, but it finally did so for me. The reason I ask you to cause errors intentionally is so that when they happen unexpectedly, you will have a better chance of knowing what caused them and how to recover from them. Do Exercise 15.5. It's hard for Lisp to do anything when its stack is already full, so just type `:loc` to the debugger, and you should see the current values of `N1` and `N2` Do Exercises 15.6 and 15.7. The answers to 15.7 are: 15.7a: `C-c C-c` 15.7b: `:cont 0` 15.7c: `:cont 1` or `:res` Do Exercises 15.8 - 15.10. Do Exercise 15.11. Note that when the error occurs, you can continue it with a new value for `N1` by entering `:cont 0` and then following the directions. Do Exercise 15.12. Note very carefully the difference between the last definition of `sum` and this definition of `sum2`. Also compare carefully the traces of `sum` and `sum2`. Do Exercise 15.15. Do Exercises 15.13 and 15.14, and submit a file called `ch15.cl` containing these two function definitions. Recall the following facts from high school algebra: x*y = (x-1)*y + y x^y = x * x^(y-1)