- let zip = \left right. left (\h sofar. sofar (\x y. isempty y
- sofar
- (make_pair (make_list (\u v. head y (u v) h) x) (tail y))
- )
- (make_pair empty (map right (\h u v. u v h)))
- )
- (\x y. reverse x) in
+ ; zip [a;b;c] [x; y; z] ~~> [(a,x);(b,y);(c,z)]
+ let zip = \left right. (\base build. reverse left build base (\x y. reverse x))
+ ; where base is
+ (make_pair empty (map (\h u. u h) right))
+ ; and build is
+ (\h sofar. sofar (\x y. isempty y
+ sofar
+ (make_pair (make_list (\u. head y (u h)) x) (tail y))
+ )) in
+