Permalink
Browse files

remove duplicate literals from clauses.

I use Data.List.nub which has quadratic run time!
  • Loading branch information...
1 parent fdafff3 commit 8c7fcbde3547dc55ae031da097e8349640fa08f1 @sebfisch committed Jan 30, 2009
Showing with 3 additions and 1 deletion.
  1. +3 −1 Data/Boolean.hs
View
@@ -25,6 +25,8 @@ module Data.Boolean (
) where
+import Data.List ( nub )
+
-- | Boolean formulas are represented as values of type @Boolean@.
--
data Boolean
@@ -76,7 +78,7 @@ type Clause = [Literal]
--
booleanToCNF :: Boolean -> CNF
booleanToCNF
- = map (map literal . disjunction)
+ = map (nub . map literal . disjunction)
. conjunction
. asLongAsPossible distribute
. asLongAsPossible pushNots

0 comments on commit 8c7fcbd

Please sign in to comment.