6
Exercise 1.6: Alyssa P. Hacker doesnât see why if
needs to be provided as a special form. âWhy canât I just define it as an ordinary procedure in terms of cond
?â she asks. Alyssaâs friend Eva Lu Ator claims this can indeed be done, and she defines a new version of if
:
if
needs to be provided as a special form. âWhy canât I just define it as an ordinary procedure in terms of cond
?â she asks. Alyssaâs friend Eva Lu Ator claims this can indeed be done, and she defines a new version of if
:Eva demonstrates the program for Alyssa:
Delighted, Alyssa uses new-if
to rewrite the square-root
program:
new-if
to rewrite the square-root
program:What happens when Alyssa attempts to use this to compute square roots? Explain.
Timeout!
But the special form if
will make sure the recursive happens only the predicate is not met.
Last updated
Was this helpful?