X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?a=blobdiff_plain;f=week9.mdwn;h=b58a87f14a0a1325c5d8fb079728c35928209b50;hb=6c5c9ad0e2612ab4dabdfd70f0496817ff0cb41a;hp=7c6f7de910a83e96523e6804c324831d9342dcce;hpb=f010b6253a11fa1af068c3f1c22f27f10867bbfd;p=lambda.git diff --git a/week9.mdwn b/week9.mdwn index 7c6f7de9..b58a87f1 100644 --- a/week9.mdwn +++ b/week9.mdwn @@ -429,6 +429,8 @@ Here's how to implement these. We'll suppose that our assignment function is lis (* evaluate expr2 using original assignment function and new store *) in eval expr2 g s'' +Note: Chris uses this kind of machinery on the third page of the Nov 22 handout. Except he implements `Let` the way we here implement `Change`. And he adds an implementation of `Alias` (see below). Some minor differences: on his handout (and following Groenendijk, Stockhof and Veltman), he uses `r` and `g` where we use `g` and `s` respectively. Also, he implements his `r` with a function from `char` to `int`, instead of a `(char * int) list`, as we do here. It should be obvious how to translate between these. His implementation requires that variables always already have an associated peg. So that when we call `Let(c, expr1, expr2)` for the first time with `c`, there's a peg whose value is to be updated. That's easier to ensure when you implement the assignment as a function than as a `(char * int) list`. + ##How to implement mutation with a State monad##