Question: 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

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)?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!