From: Jim Pryor Date: Thu, 30 Sep 2010 19:55:57 +0000 (-0400) Subject: tweaked arithmetic X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=49c3a5fc92288886f467bd231ae13818fbabf75c;hp=6dcf7995023877c6946a45657126ead9266dcb40 tweaked arithmetic Signed-off-by: Jim Pryor --- diff --git a/arithmetic.mdwn b/arithmetic.mdwn index beedc287..62e72bf2 100644 --- a/arithmetic.mdwn +++ b/arithmetic.mdwn @@ -45,9 +45,8 @@ Here are a bunch of pre-tested operations for the untyped lambda calculus. In so let map = \f lst. lst (\h sofar. make_list (f h) sofar) empty in let filter = \f lst. lst (\h sofar. f h (make_list h sofar) sofar) empty in ; or let filter = \f lst. lst (\h. f h (make_list h) I) empty in - - ; append list2 to list1 with: list1 make_list list2 let singleton = \x f z. f x z in + ; append list2 to list1 with: list1 make_list list2 let reverse = \lst. lst (\h sofar. sofar make_list (singleton h)) empty 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)) @@ -58,7 +57,6 @@ Here are a bunch of pre-tested operations for the untyped lambda calculus. In so sofar (make_pair (make_list (\u. head y (u h)) x) (tail y)) )) in - let all = \f lst. lst (\h sofar. and sofar (f h)) true in let any = \f lst. lst (\h sofar. or sofar (f h)) false in