X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=lambda_library.mdwn;h=ff363756f904d823546611348260f5caf4cd79c5;hp=289b28438916da6ca8a35ff9d23b34e772e43177;hb=aa056fb83840d1a281992dc6e7db351cc513e681;hpb=9cb038c46ca337f654266aa75769bb304ed3cafb diff --git a/lambda_library.mdwn b/lambda_library.mdwn index 289b2843..ff363756 100644 --- a/lambda_library.mdwn +++ b/lambda_library.mdwn @@ -65,7 +65,7 @@ and all sorts of other places. Others of them are our own handiwork. ; more efficient reverse builds a left-fold instead ; (make_left_list a (make_left_list b (make_left_list c empty)) ~~> \f z. f c (f b (f a z)) let reverse = (\make_left_list lst. lst make_left_list empty) (\h t f z. t f (f h z)) in - ; zip [a;b;c] [x; y; z] ~~> [(a,x);(b,y);(c,z)] + ; 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)) @@ -296,3 +296,28 @@ and all sorts of other places. Others of them are our own handiwork. --> + + +