Consider the computation of
(free-vars
(make-app
(make-lam
'x
(make-app
'x
(make-lam
'y
(make-app
'x
(make-app 'y 'z)))))
(make-lam
'y
(make-app
'u
(make-lam
'z
(make-app
'x
(make-app 'y 'z)))))))
Which of the following will appear as calls to free-vars-in-subexp during this computation?
(make-app 'y 'z)
in this fredexp. The first is inside
(make-lam 'x
...
(make-lam 'y
...))
and the second is inside
(make-lam 'y
...
(make-lam 'z
...))
If we look at the code for free-vars-in-subexp, we see that the innermost lambda variable always occurs first. So the right answers are 1 (corresponding to the first occurrence with the lambda variables listed inside out) and 3 (corresponding to the second occurrence with the lambda variables listed inside out).
Last modified: Sat Oct 31 12:30:11 Eastern Daylight Time 2015