Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove duplicate literals from clauses.

I use Data.List.nub which has quadratic run time!
  • Loading branch information...
commit 8c7fcbde3547dc55ae031da097e8349640fa08f1 1 parent fdafff3
@sebfisch authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 Data/Boolean.hs
View
4 Data/Boolean.hs
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.