-eql [] l2 = empty l2
-eql (l1h:l1t) l2 = and (not (empty l2))
- (l1h == head l2)
- (eql l1t (tail l2))
-
-Simple rearangement:
-
-eql [] = \l2 -> empty l2
-eql (l1h:l1t) = \l2 -> and (not (empty l2))
- (l1h == head l2)
- (eql l1t (tail l2))
-
-and another one rearrangement:
-
-eql [] = \l2 -> empty l2
-eql (l1h:l1t) = let prev = eql l1t
- in \l2 -> and (not (empty l2))
- (l1h == head l2)
- (prev (tail l2))
-
-Now it fits the pattern of foldr
-
-So, the end result:
-
-eql = foldr f z
- where
- z = empty
- f h z = \l2 -> and (not (empty l2))
- (h == head l2)
- (z (tail l2))
--->
-
-<!--