assignment7 tweaks
[lambda.git] / hints / assignment_7_hint_2.mdwn
index 9a208c7..07d6a7c 100644 (file)
@@ -1,5 +1,5 @@
 
-*      GS&V's semantics involves elements from several different monads we've been looking at. First, they're working with (epistemic) modalities, so there are worlds playing a role like they did in [[Reader Monads for Intensionality]]. But we're going to ignore the modal element for this exercise. There's also variable binding, which is another reader monad. Next, there is a notion of a store, which some operations add new reference cells to. We implement this with a state monad (and so too do they, in effect, though they don't conceive of what they're doing in those terms). So we'll be working with a combination of both a reader monad for the variable binding and a state monad to keep track of the new "pegs" or reference cells.
+*      GS&V's semantics involves elements from several different monads we've been looking at. First, they're working with (epistemic) modalities, so there are worlds playing a role like they did in [[Reader Monad for Intensionality]]. But we're going to ignore the modal element for this exercise. There's also variable binding, which is [another reader monad](/reader_monad_for_variable_binding). Next, there is a notion of a store, which some operations add new reference cells to. We implement this with a state monad (and so too do they, in effect, though they don't conceive of what they're doing in those terms). So we'll be working with a combination of both a reader monad for the variable binding and a state monad to keep track of the new "pegs" or reference cells.
 
        There are systematic ways to layer different monads together. If you want to read about these, a keyword is "monad transformers." Ken Shan discusses them in [his paper](http://arxiv.org/abs/cs/0205026v1) that we recommended earlier.
 
                let bind_set (u: 'a set) (f: 'a -> 'b set) =
                        List.concat (List.map f u);;
 
-*      So GS&V's information states, which they notate using `s`, are set-monads, whose elements in turn are discourse possibilities, which they notate using `i`, which are state monads that keep track of which entities have been introduced as objects of discourse, and which variables are bound to them, in a given discourse possibility.
+The following will be useful later: persuade yourself that `List.filter (test : 'a -> bool) (u : 'a set) : 'a set` is the same as:
+
+               bind_set u (fun a -> if test a then unit_set a else empty_set)
+
+
+*      So GS&V's information states, which they notate using `s`, are set-monads, whose elements in turn are discourse possibilities, which they notate using `i`, which are state monads that keep track of which entities have been introduced as objects of discourse, and which variables are bound to them, in the discourse possibility in question. In GS&V's system, possibilities are triples of an assignment function, `r`, a store `g`, and a world `w`. We're leaving the worlds out. Also, instead of just working with pairs `(r, g)`, we're working with state monads for which those pairs constitute the states we update.
 
 
 *      [More hints](/hints/assignment_7_hint_3).