assignment7 tweaks
[lambda.git] / hints / assignment_7_hint_3.mdwn
index bbdea69..ad6d7ea 100644 (file)
                let bind_set (u: 'a set) (f: 'a -> 'b set) =
                        List.concat (List.map f u);;
 
+
 *      Reviewing: GS&V's "information states," which they notate using `s`, are sets of what they call "possibilities," and notate using `i`. Instead of sets of possibilities, which get updated to sets of other, "extended" possibilities, we'll work with sets of discourse possibility monads, which are functions from discourse possibilities to values and possibly "extended" discourse possibilities.
 
+
 *      In def 2.5, GS&V say the denotation of an e-type constant <code>&alpha;</code> wrt a discourse possibility `(r, h, w)` is whatever entity the world `w` associates with <code>&alpha;</code>. Since we don't have worlds, this will just be an entity.
 
        They say the denotation of a predicate is whatever extension the world `w` associates with the predicate. Since we don't have worlds, this will just be an extension, or a function from entities to `bool`s.
 It will be useful to have a shorthand way of referring to this operation:
 
                let new_peg_and_assign (var_to_bind : char) (d : entity) =
-                       fun ((r, h) : assignment * store) ->
-                               (* first we calculate an unused index *)
-                               let newindex = List.length h
-                               (* next we store d at h[newindex], which is at the very end of h *)
-                               (* the following line achieves that in a simple but inefficient way *)
-                               in let h' = List.append h [d]
-                               (* next we assign 'x' to location newindex *)
-                               in let r' = fun v ->
-                                       if v = var_to_bind then newindex else r v
-                               in (r',h')
-
-*      Is that enough? If not, here are some [more hints](/hints/assignment_7_hint_4).
+                       (* we want to return not a function that we can bind to a bool dpm *)
+                       fun (truth_value : bool) : bool dpm ->
+                               fun ((r, h) : assignment * store) ->
+                                       (* first we calculate an unused index *)
+                                       let new_index = List.length h
+                                       (* next we store d at h[new_index], which is at the very end of h *)
+                                       (* the following line achieves that in a simple but inefficient way *)
+                                       in let h' = List.append h [d]
+                                       (* next we assign 'x' to location new_index *)
+                                       in let r' = fun var ->
+                                               if var = var_to_bind then new_index else r var
+                                       (* we pass through the same truth_value that we started with *)
+                                       in (truth_value, r', h')
+
+*      Is that enough? If not, here are some [more hints](/hints/assignment_7_hint_4). But try to get as far as you can on your own.