-5. First, you need to get [[the evaluation
-code|code/reduction_with_environments.ml]] working. Look in the
-code for places where you see "not yet implemented", and get enough of
-those places working that you can use the code to evaluate terms.
-
-6. A snag: what happens when we want to replace a variable with a term
-that itself contains a free variable?
-
- term environment
- ------------- -------------
- (\w.(\y.y)w)2 []
- (\y.y)w [w->2]
- y [w->2, y->w]
-
-In the first step, we bind `w` to the argument `2`. In the second
-step, we bind `y` to the argument `w`. In the third step, we would
-like to replace `y` with whatever its current value is according to
-our scorecard. On the simple-minded view, we would replace it with
-`w`. But that's not the right result, because `w` itself has been
-mapped onto 2. What does your evaluator code do?
-
-We'll guide you to a solution involving closures. The first step is
-to allow values to carry around a specific environment with them:
-
- type value = LiteralV of literal | Closure of lambdaTerm * env
-
-This will provide the extra information we need to evaluate an
-identifier all the way down to the correct final result. Here is a
-[[modified version of the evaluator that provides all the scaffoling for
-passing around closures|exercises/reduction_with_closures]].
-The problem is with the following line:
-
- | Closure (Abstract(bound_ident, body), saved_r) -> eval body (push bound_ident arg saved_r) (* FIX ME *)
-
-What should it be in order to solve the problem?