X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=topics%2F_week3_eval_order.mdwn;h=5944cb3b1485d81cd80724798201e19c99a37ce8;hp=18359b8f47d10bcce747e5cfa794638d27710a31;hb=8b4fc32ec904cba61e9fd304c971f9e5dc465d88;hpb=e4e1e0f2f5156d78cd2d896d9f3c711babd7ac15 diff --git a/topics/_week3_eval_order.mdwn b/topics/_week3_eval_order.mdwn index 18359b8f..5944cb3b 100644 --- a/topics/_week3_eval_order.mdwn +++ b/topics/_week3_eval_order.mdwn @@ -203,7 +203,7 @@ Some lambda terms can be reduced in different ways:
                      ((\x.x)((\y.y) z))
                        /      \
-                      /        \  
+                      /        \
                      /          \
                     /            \
                     ((\y.y) z)   ((\x.x) z)
@@ -223,7 +223,7 @@ same place.  It's like travelling in Manhattan: if you walk uptown
 first and then head east, you end up in the same place as if you walk
 east and then head uptown.
 
-But which lambda you target has implications for efficiency and for 
+But which lambda you target has implications for efficiency and for
 termination.  (Later in the course, it will have implications for
 the order in which side effects occur.)
 
@@ -237,8 +237,8 @@ First, efficiency:
                            \     /
                             \   /
                              \ /
-                              w    
-
+ w + If a function discards its argument (as `\x.w` does), it makes sense to target that function for reduction, rather than wasting effort @@ -254,10 +254,10 @@ But: (((\y.y) z)((\y.y) z) ((\x.xx) z) / | / / (((\y.y)z)z) / - / | / + / | / / | / / | / - (z ((\y.y)z)) | / + (z ((\y.y)z)) | / \ | / -----------.--------- | @@ -268,7 +268,7 @@ This time, the leftmost function `\x.xx` copies its argument. If we reduce the rightmost lambda first (rightmost branch of the diagram), the argument is already simplified before we do the copying. We arrive at the normal form (i.e., the form that cannot be -further reduced) in two steps. +further reduced) in two steps. But if we reduce the rightmost lambda first (the two leftmost branches of the diagram), we copy the argument before it has been evaluated.