continuing assignment4
[lambda.git] / hints / assignment_4_hint_2.mdwn
1 Hints for list\_equal.
2
3 <!--
4 let list_equal =
5     \left right. left
6                 ; here's our f
7                 (\hd sofar.
8                     ; deconstruct our sofar-pair
9                     sofar (\might_be_equal right_tail.
10                         ; our new sofar
11                         make_pair
12                         (and (and might_be_equal (not (isempty right_tail))) (eq? hd (head right_tail)))
13                         (tail right_tail)
14                     ))
15                 ; here's our z
16                 ; we pass along the fold a pair
17                 ; (might_for_all_i_know_still_be_equal?, tail_of_reversed_right)
18                 ; when left is empty, the lists are equal if right is empty
19                 (make_pair
20                     true ; for all we know so far, they might still be equal
21                     (reverse right)
22                 )
23                 ; when fold is finished, check sofar-pair
24                 (\might_be_equal right_tail. and might_be_equal (isempty right_tail))
25 -->