4 <LI>How would you define an operation to reverse a list? (Don't peek at the
5 [[lambda_library]]! Try to figure it out on your own.) Choose whichever
6 implementation of list you like. Even then, there are various strategies you
9 (See [[hints/Assignment 4 hint 1]] if you need some hints.)
13 #Comparing lists for equality#
23 ; deconstruct our sofar-pair
24 sofar (\might_be_equal right_tail.
27 (and (and might_be_equal (not (isempty right_tail))) (eq? hd (head right_tail)))
31 ; we pass along the fold a pair
32 ; (might_for_all_i_know_still_be_equal?, tail_of_reversed_right)
33 ; when left is empty, the lists are equal if right is empty
35 true ; for all we know so far, they might still be equal
38 ; when fold is finished, check sofar-pair
39 (\might_be_equal right_tail. and might_be_equal (isempty right_tail))
42 #Mutually-recursive functions#
49 #Enumerating the fringe of a leaf-labeled tree#
51 [[Implementing trees]]