For each of program points 1, 2, 3, 4 and 5, please describe the environment in effect after evaluation has reached
that point. You may assume that the evaluation begins in an empty environment, and that the environment is cumu-
lative thereafter. The program points are supposed to indicate points at which all complete preceding declarations
have been fully evaluated. In describing the environments 1 through 4, you may use set notation, as done in class,
or you may use the update operator
+
. If you use set notation, no duplicate bindings should occur. The answer for
program point 5 should be written out fully in set notation.
Solution:
•
ρ
1
=
{
y
→
17
, x
→
3
.
9
}
•
ρ
2
=
{
x
→
4
}
+
ρ
1
=
{
x
→
4
, y
→
17
}
•
ρ
3
=
{
z
→
21
}
+
ρ
1
=
{
z
→
21
, y
→
17
, x
→
3
.
9
}
•
ρ
4
=
{
f
→ h
x
7→
fun y -> x + y + z
, ρ
3
i}
+
ρ
3
=
{
f
→ h
x
7→
fun y -> x + y + z
, ρ
3
i
, z
→
21
, y
→
17
, x
→
3
}
• {
z
→
63
, g
→ h
w
7→
f w w
, ρ
4
i
, f
→ h
x
7→
fun y -> x + y + z
, ρ
3
i
, y
→
17
, x
→
3
}
=
{
z
→
63
,
g
→ h
w
7→
f w w
,
{
f
→ h
x
7→
fun y -> x + y + z
,
{
z
→
21
, y
→
17
, x
→
3
.
9
}i
,
z
→
21
, y
→
17
, x
→
3
}i
,
f
→ h
x
7→
fun y -> x + y + z
,
{
z
→
21