Exercise 12.x1: Consider the following ML function definition:
fun f x = let fun g y = x + y fun h z = let fun p w = g (w + z) in p x end in h (x + 1) end;
Suppose that the expression
f(3) is evaluated. At some point
during this evaluation, the procedure named
g is invoked. Draw
a picture of all the activation records that would exist at that
point. Indicate which of the activation records is the current one at
that point. In each activation record, you can leave out the
variables that are names of nested functions and instead just include
the numeric local variable
(with its name and value), the pointer to the previous activation
record, and the nesting link. (Label the pointer to the previous
activation record with P and the nesting link with NL.)
Do exercise 12.4 on page 205.
Do exercise 12.5 on page 205.
Do exercise 12.7 on page 205.