X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=topics%2Fweek4_more_about_fixed_point_combinators.mdwn;h=3d4f50a45a3aab82a4ccfccf0e9dcb8af246edbe;hp=763c18b3c45f1044e81a7c636664b4b280bc9289;hb=78224e38c4180c85570589e3c9fabfe1fde5365e;hpb=6e8c0b6ef145063c3ad51bba4bf46061f40674c7
diff --git a/topics/week4_more_about_fixed_point_combinators.mdwn b/topics/week4_more_about_fixed_point_combinators.mdwn
index 763c18b3..3d4f50a4 100644
--- a/topics/week4_more_about_fixed_point_combinators.mdwn
+++ b/topics/week4_more_about_fixed_point_combinators.mdwn
@@ -370,3 +370,25 @@ Success.
So the function `\h. (\u. h (u u)) (\u. h (u u))` maps an arbitrary term
`h` to a fixed point for `h`.
+
+
+## Q: How does this relate to the discussion in Chapter 9 of The Little Schemer? ##
+
+A: Pages 160-172 of *The Little Schemer* introduce you to how to implement recursion in Scheme, without relying on the native capacity to do this expressed in `letrec` or `define`. The expression:
+
+ (lambda (length)
+ (lambda (l)
+ (cond
+ ((null? l) 0)
+ (else (add1 (length (cdr l)))))))
+
+that occurs starting on p. 162 and on several pages following corresponds to `h` in [[our exposition|week4_fixed_point_combinators#little-h]]. The authors of *The Little Schemer* begin by applying that abstract to the argument `eternity`, which is a function that never returns; then they instead apply it to the argument `h eternity`, which is a function that works for lists of length zero, but otherwise never returns; then to the argument `h (h eternity)`, which works for lists of length zero or one, but otherwise never returns; and so on.
+
+They work their way towards the realization that they want an "infinite tower" of applications of `h`, except they don't really need an infinite tower, but rather just a finite tower whose height can't be bounded in advance. This is essentially the observation that they need a fixed point for `h`.
+
+The authors attempt to self-apply `h` on p. 165, just as we did. As we explained in [[our exposition|week4_fixed_point_combinators#deriving-y]], though, that doesn't quite work.
+
+On the top of p. 167, the authors have instead moved to our `H`, and attempt to self-apply that, instead. And this works.
+
+However, on p. 168, they attempt to abstract out the part that in our `H` looks like `(u u)` and in their exposition looks like `(mk-length mk-length)`. Doing that *would* work in our lambda evaluator, but you can't do it in Scheme, because Scheme has call-by-value evaluation order, which will try to fully reduce this expression before substituting it back into the term it's been abstracted out of. But it can't be fully reduced. Pages 168--170 explore this problem, and pp. 170--172 hit upon the solution of using what we called in our exposition the `Yâ²` fixed-point combinator, rather than the `Y` combinator that we derived. The authors of *The Little Schemer* call `Yâ²` the "applicative-order Y combinator".
+