From: Jim Pryor Date: Mon, 20 Sep 2010 16:10:53 +0000 (-0400) Subject: numbers: tweaks X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=b8e19b5e0cab0ceab3d7471f28c291bcc199bbd6 numbers: tweaks Signed-off-by: Jim Pryor --- diff --git a/lists_and_numbers.mdwn b/lists_and_numbers.mdwn index 6640d170..e047312e 100644 --- a/lists_and_numbers.mdwn +++ b/lists_and_numbers.mdwn @@ -275,10 +275,14 @@ So, for example: Adding *m* to *n* is a matter of applying the successor function to *n* *m* times. And we know how to apply an arbitrary function s to *n* *m* times: we just give that function s, and the base-value *n*, to *m* as arguments. Because that's what the function we're using to implement *m* *does*. Hence **add** can be defined to be, simply: - \m \n. m succ n + \m n. m succ n Isn't that nice? +Alternatively, one could do: + + \m n. \s z. m s (n s z) + How would we tell whether a number was 0? Well, look again at the implementations of the first few numbers:
zero ≡ \s z. s0 z ≡ \s z. z