Friday, April 18, 2008

Exercise 1.5

If the interpreter uses applicative-order evaluation, it will go into an infinite loop when it evaluates the second argument (p). This does (p), which does (p), and so on.

If the interpreter uses normal-order evaluation, it will not begin by evaluating the second argument. It executes the test expression with the unevaluated arguments. Because the first argument is 0, the result is 0; the second argument is left unevaluated, and no infinite loop occurs.

No comments: