Skip to content

Commit

Permalink
refactor: internal engine now handles multiple copies of objects
Browse files Browse the repository at this point in the history
The parser still doesn't, but it's comparatively easy. After that we
are done with #10.

This implied a large amount of refactoring. The code is all the
better.
  • Loading branch information
aspiwack committed Aug 15, 2019
1 parent e37cf34 commit 21fccd7
Show file tree
Hide file tree
Showing 5 changed files with 549 additions and 330 deletions.
4 changes: 2 additions & 2 deletions src/formula.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let rec vars = function
| Impl (x,y) -> Seq.flat_map vars (List.to_seq [x;y])
| Not x -> vars x

let pp pp_var f fmt =
let pp pp_var fmt f =
let and_prec = 2
and or_prec = 3
and impl_prec = 1
Expand All @@ -45,7 +45,7 @@ let pp pp_var f fmt =
match f with
| One -> Format.fprintf fmt "1"
| Zero -> Format.fprintf fmt "0"
| Var x -> pp_var x fmt
| Var x -> pp_var fmt x
| And (x,y) when prec <= and_prec -> Format.fprintf fmt "%t && %t" (pp and_prec x) (pp and_prec y)
| Or (x,y) when prec <= or_prec -> Format.fprintf fmt "%t || %t" (pp or_prec x) (pp or_prec y)
| Impl (x,y) when prec <= impl_prec -> Format.fprintf fmt "%t --> %t" (pp (impl_prec+1)x) (pp impl_prec y)
Expand Down
Loading

0 comments on commit 21fccd7

Please sign in to comment.