post ass5
[lambda.git] / lists_and_numbers.mdwn
index 6640d17..571ed7b 100644 (file)
@@ -1,3 +1,5 @@
+[[!toc]]
+
 Building Lists
 ==============
 
@@ -275,10 +277,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:
 
 <pre><code>zero &equiv; \s z. s<sup>0</sup> z &equiv; \s z. z