From: Jim Pryor Date: Sun, 3 Oct 2010 01:38:28 +0000 (-0400) Subject: arithmetic tweaks X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=e1860468dc97e6249ecd19e96a2e7fffe9430d0e;ds=sidebyside arithmetic tweaks Signed-off-by: Jim Pryor --- diff --git a/arithmetic.mdwn b/arithmetic.mdwn index fafecafd..289b2843 100644 --- a/arithmetic.mdwn +++ b/arithmetic.mdwn @@ -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 + +