Gaining control over order of evaluation ---------------------------------------- We know that evaluation order matters. We're beginning to learn how to gain some control over order of evaluation (think of Jim's abort handler). We continue to reason about order of evaluation. A lucid discussion of evaluation order in the context of the lambda calculus can be found here: [Sestoft: Demonstrating Lambda Calculus Reduction](http://www.itu.dk/~sestoft/papers/mfps2001-sestoft.pdf). Sestoft also provides a lovely on-line lambda evaluator: [Sestoft: Lambda calculus reduction workbench](http://www.itu.dk/~sestoft/lamreduce/index.html), which allows you to select multiple evaluation strategies, and to see reductions happen step by step. Evaluation order matters ------------------------ We've seen this many times. For instance, consider the following reductions. It will be convenient to use the abbreviation `w = \x.xx`. I'll indicate which lambda is about to be reduced with a * underneath:
```(\x.y)(ww)
*
y
```
Done! We have a normal form. But if we reduce using a different strategy, things go wrong:
```(\x.y)(ww) =
(\x.y)((\x.xx)w) =
*
(\x.y)(ww) =
(\x.y)((\x.xx)w) =
*
(\x.y)(ww)
```
Etc. As a second reminder of when evaluation order matters, consider using `Y = \f.(\h.f(hh))(\h.f(hh))` as a fixed point combinator to define a recursive function:
```Y (\f n. blah) =
(\f.(\h.f(hh))(\h.f(hh))) (\f n. blah)
*
(\f.f((\h.f(hh))(\h.f(hh)))) (\f n. blah)
*
(\f.f(f((\h.f(hh))(\h.f(hh))))) (\f n. blah)
*
(\f.f(f(f((\h.f(hh))(\h.f(hh)))))) (\f n. blah)
```