arithmetic tweaks
authorJim Pryor <profjim@jimpryor.net>
Sun, 3 Oct 2010 01:38:28 +0000 (21:38 -0400)
committerJim Pryor <profjim@jimpryor.net>
Sun, 3 Oct 2010 01:38:28 +0000 (21:38 -0400)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
arithmetic.mdwn

index fafecaf..289b284 100644 (file)
@@ -1,5 +1,17 @@
 Here are a bunch of pre-tested operations for the untyped lambda calculus. In some cases multiple versions are offered.
 
+Some of these are drawn from:
+
+*      [[!wikipedia Lambda calculus]]
+*      [[!wikipedia Church encoding]]
+*      Oleg's [Basic Lambda Calculus Terms](http://okmij.org/ftp/Computation/lambda-calc.html#basic)
+
+and all sorts of other places. Others of them are our own handiwork.
+
+
+**Spoilers!** Below you'll find implementations of map and filter for v3 lists, and several implementations of leq for Church numerals. Those were all requested in Assignment 2; so if you haven't done that yet, you should try to figure them out on your own. (You can find implementations of these all over the internet, if you look for them, so these are no great secret. In fact, we'll be delighted if you're interested enough in the problem to try to think through alternative implementations.)
+
+
        ; booleans
        let true = \y n. y  in ; aka K
        let false = \y n. n  in ; aka K I
@@ -228,6 +240,10 @@ Here are a bunch of pre-tested operations for the untyped lambda calculus. In so
        let length = Y (\self lst. isempty lst 0 (succ (self (tail lst))))  in
 
 
+       true
+
+<!--
+
        ; numhelper 0 f z ~~> z
        ; when n > 0: numhelper n f z ~~> f (pred n)
        ; compare Bunder/Urbanek pred
@@ -239,7 +255,7 @@ Here are a bunch of pre-tested operations for the untyped lambda calculus. In so
 
 
        fact Theta 3  ; returns 6
-
+-->
 
 <!--
        ; my original efficient comparisons
@@ -276,6 +292,7 @@ Here are a bunch of pre-tested operations for the untyped lambda calculus. In so
 
                negate_int = \int. sign_case int (church_to_negint (abs int)) zero (church_to_int (abs int))
 
-       for more, see http://okmij.org/ftp/Computation/lambda-arithm-neg.scm
+       for more, see http://okmij.org/ftp/Computation/lambda-calc.html#neg
+
 
 -->