X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=hints%2Fassignment_7_hint_6.mdwn;h=77b47926361117da69fd61bedd3054a44c613747;hp=0d9f02e8af9f33c454cfadef6dc6ce8ddf37dd95;hb=c022f10edea8eca8c68b010c07d4f72921e484c9;hpb=c6f572fd09dbe53dff30a91cd07b318b3e5edfd6 diff --git a/hints/assignment_7_hint_6.mdwn b/hints/assignment_7_hint_6.mdwn index 0d9f02e8..77b47926 100644 --- a/hints/assignment_7_hint_6.mdwn +++ b/hints/assignment_7_hint_6.mdwn @@ -39,7 +39,7 @@ let or_op (phi : clause) (psi : clause) = fun one_dpm -> unit_set ( fun (r, h) -> - in let truth_value' = ( + let truth_value' = ( truths (phi one_dpm) (r, h) <> [] || truths (bind_set (negate_op phi one_dpm) psi) (r, h) <> [] ) in (truth_value', r, h)) @@ -47,7 +47,7 @@ let if_op (phi : clause) (psi : clause) : clause = fun one_dpm -> unit_set ( fun (r, h) -> - in let truth_value' = List.for_all (fun one_dpm -> + let truth_value' = List.for_all (fun one_dpm -> let (truth_value, _, _) = one_dpm (r, h) in truth_value = false || truths (psi one_dpm) (r, h) <> [] ) (phi one_dpm) @@ -76,6 +76,8 @@ type clause = bool dpm -> bool dpm set;; +* More: + (* this generalizes the getx function from hint 4 *) let get (var : char) : entity dpm = fun (r, h) -> @@ -100,8 +102,6 @@ else bind_dpm entity1_dpm (fun e1 -> bind_dpm entity2_dpm (fun e2 -> unit_dpm (f e1 e2))) in fun one_dpm -> unit_set (bind_dpm one_dpm eliminator);; -  - let new_peg_and_assign (var_to_bind : char) (d : entity) : bool -> bool dpm = fun truth_value -> fun (r, h) -> @@ -119,6 +119,8 @@ (* include negate_op, and_op, or_op, and if_op as above *) +* More: + (* some handy utilities *) let (>>=) = bind_set;; let getx = get 'x';;