aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-03-31 19:37:22 +0200
committerCamil Staps2016-03-31 19:37:22 +0200
commit926318dc6938a55df4658f8af46b069352ccb458 (patch)
tree119ca9da7c7bd507bd5129b56816ecb8aa0f3da8
parentFixed bug where atom options were duplicated (diff)
Fixed issue where truth tables had too many options
-rw-r--r--Logic.icl9
1 files changed, 5 insertions, 4 deletions
diff --git a/Logic.icl b/Logic.icl
index 0406d1f..0b5c0cf 100644
--- a/Logic.icl
+++ b/Logic.icl
@@ -226,11 +226,12 @@ all_atoms (App1 _ e) = all_atoms e
all_atoms (App2 e1 _ e2) = removeDup (all_atoms e1 ++ all_atoms e2)
all_atom_options :: Expr -> [[AtomOption]]
-all_atom_options e = [opt \\ opt <- all_options (all_atoms e) []]
+all_atom_options e = removeDup [opt \\ opt <- all_opts (sort (all_atoms e)) []]
where
- all_options :: [AtomName] [AtomOption] -> [[AtomOption]]
- all_options [] opts = [opts]
- all_options [a:as] opts = all_options as (opts ++ [(a,False)]) ++ all_options as (opts ++ [(a,True)])
+ all_opts :: [AtomName] [AtomOption] -> [[AtomOption]]
+ all_opts [] opts = [opts]
+ all_opts [a:as] opts
+ = all_opts as (opts ++ [(a,False)]) ++ all_opts as (opts ++ [(a,True)])
substitute :: AtomOption Expr -> Expr
substitute (a,b) (Atom a`)