From: Jim Pryor
Date: Sat, 16 Oct 2010 18:48:29 +0000 (-0400)
Subject: alternate Y1,Y2 tweak
X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=8c28339b991f2d4f0940d295bf4d265a00751b05
alternate Y1,Y2 tweak
Signed-off-by: Jim Pryor
---
diff --git a/hints/assignment_4_hint_3_alternate_1.mdwn b/hints/assignment_4_hint_3_alternate_1.mdwn
index 900c6cb1..99a4202b 100644
--- a/hints/assignment_4_hint_3_alternate_1.mdwn
+++ b/hints/assignment_4_hint_3_alternate_1.mdwn
@@ -11,15 +11,23 @@ Alternate strategy for Y1, Y2
is implemented using regular, non-mutual recursion, like this (`u` is a variable not occurring free in `A`, `B`, or `C`):
- let rec u g x = (let f = u g in A)
+ let rec u g x = (let f = u g in A)
in let rec g y = (let f = u g in B)
- in let f = u g in
+ in let f = u g in
C
or, expanded into the form we've been working with:
let u = Y (\u g x. (\f. A) (u g)) in
- let g = Y (\g y. (\f. B) (u g)) in
- let f = u g in
+ let g = Y ( \g y. (\f. B) (u g)) in
+ let f = u g in
C
+* Here's the same strategy extended to three mutually-recursive functions. `f`, `g` and `h`:
+
+ let u = Y (\u g h x. (\f. A) (u g h)) in
+ let w = Y ( \w h x. (\g. (\f. B) (u g h)) (w h)) in
+ let h = Y ( \h x. (\g. (\f. C) (u g h)) (w h)) in
+ let g = w h in
+ let f = u g h in
+ D