week11 tweaks
[lambda.git] / hints / assignment_4_hint_2.mdwn
index 8acdb13..f9f4cf2 100644 (file)
@@ -39,22 +39,22 @@ let list_equal =
 -->
 
 <!--
 -->
 
 <!--
-eql [] l2        = empty l2
-eql (l1h:l1t) l2 = and (not (empty l2))
-                       (l1h == head l2)
-                       (eql l1t (tail l2))
+list_equal [] right      = isempty right
+list_equal (hd:tl) right = and (not (isempty right))
+                            (hd == head right)
+                            (list_equal tl (tail right))
 
 Rearangement:
 
 
 Rearangement:
 
-eql []        = \l2 -> empty l2
-eql (l1h:l1t) = let prev = eql l1t
-                in \l2 -> and (not (empty l2))
-                              (l1h == head l2)
-                              (prev (tail l2))
+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 foldr
+Now it fits the pattern of fold_right
 
 
-let list_equal = \lst. lst (\hd sofar. \lst. and (and (not (isempty lst)) (eq hd (head lst))) (sofar (tail lst))) isempty
+let list_equal = \left. left (\hd sofar. \right. and (and (not (isempty right)) (eq hd (head right))) (sofar (tail right))) isempty
 
 -->
 
 
 -->