final note
[lambda.git] / topics / week2_encodings.mdwn
index c345ac0..5bb69d6 100644 (file)
@@ -405,4 +405,19 @@ The encoding for `0` can also be written as `\f z. z`, which we've also proposed
 
 Given the above, can you figure out how to define the `succ` function? We already worked through the definition of `cons`, and this is just a simplification of that, so you should be able to do it. We'll make it a homework.
 
 
 Given the above, can you figure out how to define the `succ` function? We already worked through the definition of `cons`, and this is just a simplification of that, so you should be able to do it. We'll make it a homework.
 
+We saw that using the `cons` operation and `[]` as arguments to `fold_right` over a list gave us back that very same list. In the Lambda Calculus, that would come down to:
+
+    [a, b, c] cons []
+
+with the appropriate lambda terms substituted throughout, would just reduce to the same lambda term we used to encode `[a, b, c]`. What do you think this would reduce to:
+
+    3 succ 0
+
+with the appropriate lambda terms substituted throughout? Since 3 is `\f z. f (f (f z))`, it should reduce to whatever:
+
+    succ (succ (succ 0))
+
+does. And if we define `succ` properly, we should expect that to give us the same lambda term that we used to encode `3` in the first place.
+
+
 We'll look at other encodings of lists and numbers later.
 We'll look at other encodings of lists and numbers later.