Question: et env be an environment { x : NumValue ( 2 5 ) , y : NumValue ( 3 0 )

et env be an environment
{"x": NumValue(25),"y": NumValue(30),"z": NumValue(40),"f": Closure("x", Plus(Ident("x"),Const(10)), env2)}
Suppose we wish to extend env to handle a recursive function call
let rec f = e in ...
Let env1 denote the environment env1=("f","x", e, env).
Which of the following values is obtained when we lookup "f" in env1?
env1(x) is undefined since x is the formal argument for the definition of g and is resolved only at its call site.
b.
env1(g)= Closure(x, e, env1)
c.
env1(z)= NumValue(3.1415)
d.
env1(g) is undefined
e.
env1(x)= env(x)
f.
env1(g)= Closure(x, e, env)

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 Programming Questions!