|CHAPTER 15: RECURSION
- Read Chapter 15
- Be sure you do the exercises of this chapter in the package
- 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
- Do Exercises 15.6 and 15.7. The answers to 15.7 are:
:cont 1 or
- 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
- 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)