assignment7 tweaks
authorJim Pryor <profjim@jimpryor.net>
Thu, 18 Nov 2010 19:19:01 +0000 (14:19 -0500)
committerJim Pryor <profjim@jimpryor.net>
Thu, 18 Nov 2010 19:19:01 +0000 (14:19 -0500)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
hints/assignment_7_hint_3.mdwn

index 0629c1b..3fec7e2 100644 (file)
@@ -11,19 +11,19 @@ We're going to keep all of that, except dropping the worlds. And instead of talk
 
 we'll just talk about \[[expression]] and let that be a monadic object, implemented in part by a function that takes `(r, g)` as an argument.
 
 
 we'll just talk about \[[expression]] and let that be a monadic object, implemented in part by a function that takes `(r, g)` as an argument.
 
-More specifically, \[[expression]] will be a set of `'a discourse possibility` monads, where `'a` is the appropriate type for *expression*, and the discourse possibility monads are themselves state monads where `(r, g)` is the state that gets updated. Those are implemented as functions from `(r, g)` to `(a, r', g')`, where `a` is a value of type `'a`, and `r', g'` are possibly altered assignment functions and stores.
+More specifically, \[[expression]] will be a set of `'a discourse_possibility` monads, where `'a` is the appropriate type for *expression*, and the discourse possibility monads are themselves state monads where `(r, g)` is the state that gets updated. Those are implemented as functions from `(r, g)` to `(a, r', g')`, where `a` is a value of type `'a`, and `r', g'` are possibly altered assignment functions and stores.
 
 *      In def 2.7, GS&V talk about an operation that takes an existing set of discourse possibilities, and extends each member in the set by allocating a new location in the store, and assigning a variable `'x'` to that location, which holds some object `d` from the domain. It will be useful to have a shorthand way of referring to this operation:
 
 
 *      In def 2.7, GS&V talk about an operation that takes an existing set of discourse possibilities, and extends each member in the set by allocating a new location in the store, and assigning a variable `'x'` to that location, which holds some object `d` from the domain. It will be useful to have a shorthand way of referring to this operation:
 
-               let newpeg_and_bind (variable : char) (d : entity) =
+               let newpeg_and_bind (bound_variable : char) (d : entity) =
                        fun ((r, g) : assignment * store) ->
                                let newindex = List.length g
                                (* first we store d at index newindex in g, which is at the very end *)
                                (* the following line achieves that in a simple but very inefficient way *)
                                in let g' = List.append g [d]
                                (* next we assign 'x' to location newindex *)
                        fun ((r, g) : assignment * store) ->
                                let newindex = List.length g
                                (* first we store d at index newindex in g, which is at the very end *)
                                (* the following line achieves that in a simple but very inefficient way *)
                                in let g' = List.append g [d]
                                (* next we assign 'x' to location newindex *)
-                               in let r' = fun variable' ->
-                                       if variable' = variable then newindex else r variable'
+                               in let r' = fun v ->
+                                       if v = bound_variable then newindex else r v
                                (* the reason for returning a triple with () in first position will emerge *)
                                in ((), r',g')
 
                                (* the reason for returning a triple with () in first position will emerge *)
                                in ((), r',g')