From 2e3a521ae5428891f03ccea9913915b5590a28fb Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 27 Nov 2016 23:28:01 +0100 Subject: Fix usage string and removeSubOptions --- Logic.icl | 9 ++++++++- LogicParser.icl | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Logic.icl b/Logic.icl index bd87bf0..7438e82 100644 --- a/Logic.icl +++ b/Logic.icl @@ -226,7 +226,14 @@ all_atoms (App1 _ e) = all_atoms e all_atoms (App2 e1 _ e2) = removeDup (all_atoms e1 ++ all_atoms e2) removeSubOptions :: [[AtomOption]] -> [[AtomOption]] -removeSubOptions opts = filter (\this -> not (any (\that -> all (flip isMember that) this) (removeMember this opts))) opts +removeSubOptions opts = remove opts opts +where + remove :: [[AtomOption]] [[AtomOption]] -> [[AtomOption]] + remove [] _ = [] + remove [opt:opts] list + | any (\x -> all (flip isMember x) opt) list` = remove opts list` + | otherwise = [opt:remove opts list] + where list` = removeMember opt list all_atom_options :: Expr -> [[AtomOption]] all_atom_options e = removeSubOptions [opt \\ opt <- all_opts (sort (all_atoms e)) []] diff --git a/LogicParser.icl b/LogicParser.icl index 852a882..0f68820 100644 --- a/LogicParser.icl +++ b/LogicParser.icl @@ -26,7 +26,7 @@ module LogicParser import StdEnv, StdMaybe, ArgEnv, Logic Start -| isEmpty exprs = abort ("Usage: " +++ argv.[0] +++ " [-e] [-html|-latex] \n") +| isEmpty exprs = abort ("Usage: " +++ argv.[0] +++ " [-e] [-html|-latex] [ ..]\n") | length (removeDup (foldr (++) [] (map all_atoms exprs))) > 8 = abort "You don't need more than 8 atomic expressions." | otherwise = show outputoption (compute (if extended truthtable_n simple_truthtable_n exprs)) where -- cgit v1.2.3