Exercise 12.x1: Consider the following ML function definition:
fun f x = let fun h z = let fun r w = w*z in r(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, show the variable names and values, 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.