update week1 notes
authorJim <jim.pryor@nyu.edu>
Sun, 1 Feb 2015 10:34:55 +0000 (05:34 -0500)
committerJim <jim.pryor@nyu.edu>
Sun, 1 Feb 2015 10:34:55 +0000 (05:34 -0500)
week1.mdwn

index b724a1b..983c18c 100644 (file)
@@ -594,9 +594,9 @@ the variable `x` has not been *overwritten* (mutated). Rather, we have *two* var
 
 evaluates to? Well, consider the right-hand side of the second binding:
 
 
 evaluates to? Well, consider the right-hand side of the second binding:
 
-      &nbsp;            let
-      &nbsp;              x match x + 1
-      &nbsp;            in (x, 2*x)
+                   let
+                     x match x + 1
+                   in (x, 2*x)
 
 This expression evaluates to `(1, 2)`, because it uses the outer binding of `x` to `0` for the right-hand side of its own binding `x match x + 1`. That gives us a new binding of `x` to `1`, which is in place when we evaluate `(x, 2*x)`. That's why the whole thing evaluates to `(1, 2)`. So now returning to the outer expression, `y` gets bound to `1` and `z` to `2`. But now what is `x` bound to in the final line,`([y, z], x)`? The binding of `x` to `1` was in place only until we got to `(x, 2*x)`. After that its scope expired, and the original binding of `x` to `0` reappears. So the final line evaluates to `([1, 2], 0)`.
 
 
 This expression evaluates to `(1, 2)`, because it uses the outer binding of `x` to `0` for the right-hand side of its own binding `x match x + 1`. That gives us a new binding of `x` to `1`, which is in place when we evaluate `(x, 2*x)`. That's why the whole thing evaluates to `(1, 2)`. So now returning to the outer expression, `y` gets bound to `1` and `z` to `2`. But now what is `x` bound to in the final line,`([y, z], x)`? The binding of `x` to `1` was in place only until we got to `(x, 2*x)`. After that its scope expired, and the original binding of `x` to `0` reappears. So the final line evaluates to `([1, 2], 0)`.