From: Jim Pryor Date: Mon, 4 Oct 2010 01:14:50 +0000 (-0400) Subject: Merge branch 'pryor' X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=0a79dd27b99169648a1f03ec0b8847a1c5b822fc;hp=93875f124b3af0b7e114373588fa110d79f9abc0 Merge branch 'pryor' --- diff --git a/assignment4.mdwn b/assignment4.mdwn index 7073dc6b..12c1ef2a 100644 --- a/assignment4.mdwn +++ b/assignment4.mdwn @@ -68,8 +68,6 @@ lists to see if they're equal. (You just programmed this above.) Write the fringe-enumeration function. It should work on the implementation of trees you designed in the previous step. - -(See [[hints/Assignment 4 hint 3]] if you need some hints.) @@ -134,7 +132,7 @@ definitions of `even` and `odd`? notes](/week3/#index4h2) as a model, construct a pair `Y1` and `Y2` that behave in the way described. -(See [[hints/Assignment 4 hint 4]] if you need some hints.) +(See [[hints/Assignment 4 hint 3]] if you need some hints.) diff --git a/hints/assignment_4_hint_3.mdwn b/hints/assignment_4_hint_3.mdwn index 48063d3a..9cfef8ad 100644 --- a/hints/assignment_4_hint_3.mdwn +++ b/hints/assignment_4_hint_3.mdwn @@ -1,2 +1,26 @@ -Hints for enumerating a tree's fringe. +Hints for Y1,Y2. + +* Begin by trying to define `X1` and `X2` directly, then once they're working, you can abstract back to a pair of combinators `Y1` and `Y2` that generate `X1` and `X2` for a given pair of arguments `T1` and `T2`. + + You want: + + X1 <~~> T1 X1 X2 and + X2 <~~> T2 X1 X2 + +* X1 is presumably going to have some form like: + + (\elem1 elem2 ... (T1 + (do-something-with-the-elems-to-make-X1) + (do-something-with-the-elems-to-make-X2) + )) + some-elem1 some-elem2 ... + + Right? What will the form of X2 be? + +* Can you see how to go on? + +* Call the displayed abstract above `(\elem1 elem2 ... (...))` "elem0". What's the relation between `X1`, `elem0`, `elem1`, `elem2`...? + +* Go on, now you can do it. + diff --git a/hints/assignment_4_hint_4.mdwn b/hints/assignment_4_hint_4.mdwn deleted file mode 100644 index 9cfef8ad..00000000 --- a/hints/assignment_4_hint_4.mdwn +++ /dev/null @@ -1,26 +0,0 @@ -Hints for Y1,Y2. - -* Begin by trying to define `X1` and `X2` directly, then once they're working, you can abstract back to a pair of combinators `Y1` and `Y2` that generate `X1` and `X2` for a given pair of arguments `T1` and `T2`. - - You want: - - X1 <~~> T1 X1 X2 and - X2 <~~> T2 X1 X2 - -* X1 is presumably going to have some form like: - - (\elem1 elem2 ... (T1 - (do-something-with-the-elems-to-make-X1) - (do-something-with-the-elems-to-make-X2) - )) - some-elem1 some-elem2 ... - - Right? What will the form of X2 be? - -* Can you see how to go on? - -* Call the displayed abstract above `(\elem1 elem2 ... (...))` "elem0". What's the relation between `X1`, `elem0`, `elem1`, `elem2`...? - -* Go on, now you can do it. - -