+++ /dev/null
-Hints for `list_equal`.
-
-* If `left` is `[]`, what does `right` have to be for `left` and `right` to be equal? (Come on, it's not too hard, you can figure it out.)
-
-* Suppose on the other hand that `left` has head `left_hd` and tail `left_tl`.
-
- <OL type=a>
- <LI>If `right` is then `[]`, are `left` and `right` equal?
- <LI>If `right` isn't `[]`, and its head isn't equal to `left_hd`, are `left` and `right` equal?
- <LI>If `right` isn't `[]` and its head *is* equal to `left_hd`, what else has to be the case for `left` and `right` to be equal?
- </OL>
-
-* Can you now write a recursive definition of the `list_equal` function?
-What's your base case?
-
-
-<!--
-let list_equal =
- \left right. left
- ; here's our f
- (\hd sofar.
- ; deconstruct our sofar-pair
- sofar (\might_be_equal right_tail.
- ; our new sofar
- make_pair
- (and (and might_be_equal (not (isempty right_tail))) (eq? hd (head right_tail)))
- (tail right_tail)
- ))
- ; here's our z
- ; we pass along the fold a pair
- ; (might_for_all_i_know_still_be_equal?, tail_of_reversed_right)
- ; when left is empty, the lists are equal if right is empty
- (make_pair
- true ; for all we know so far, they might still be equal
- (reverse right)
- )
- ; when fold is finished, check sofar-pair
- (\might_be_equal right_tail. and might_be_equal (isempty right_tail))
--->
-
-<!--
-list_equal [] right = isempty right
-list_equal (hd:tl) right = and (not (isempty right))
- (hd == head right)
- (list_equal tl (tail right))
-
-Rearangement:
-
-list_equal [] = \right -> isempty right
-list_equal (hd:tl) = let prev = list_equal tl
- in \right -> and (not (isempty right))
- (hd == head right)
- (prev (tail right))
-
-Now it fits the pattern of fold_right
-
-let list_equal = \left. left (\hd sofar. \right. and (and (not (isempty right)) (eq hd (head right))) (sofar (tail right))) isempty
-
--->
-