Exercise 12.x1: Consider the following ML function definition:
fun f x = let fun h z = let fun p w = w*z in p(x+1) end fun g y = h(x+y) in g x end;
Suppose that the expression
f(3) is evaluated. Draw
a picture of all the activation records that would exist when the multiplication
takes place. 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 203.
Do exercise 12.5 on page 204.
Do exercise 12.7 on page 204.