Scheme Question
The following program can be used to determine if a given interpreter is using applicative-order evaluations or normal-order evaluation:
(define (p)(p)) (define (test x y) (if (= x 0) 0 y)) (test 0 (p))
(Assume that the evaluation rule for the special form 'if' is the same for both evaluation schemes: The predicate (condition) expression is evaluated first, and the result determines whether to evaluate the consequent (then) or the alternative (else) expression.)
What will be the behaviour of this code on an interpreter that uses applicative-order evaluation? Explain why.
What behaviour will be observed with an interpreter that uses normal-order evaluation? Explain why.
Which style of interpreter does Scheme use (assuming #lang R5RS)?