Commits

Eric Rochester committed 0c0f181

Added rule-enforcing data structures to the Compressor.

  • Participants
  • Parent commits 97ff59f

Comments (0)

Files changed (1)

src/Data/Sequitur.hs

 
 -- | This is the compressor data types.
 data Compressor a = Compressor {
-      rules     :: M.Map Integer (RuleBody a)       -- The list of rules defined.
-    , ruleCount :: Integer                      -- The number of rules defined.
+      rules       :: M.Map Integer (RuleBody a)     -- The list of rules defined.
+    , ruleCount   :: Integer                        -- The number of rules defined.
+    , ruleUtility :: M.Map Integer Integer          -- The number of times each rule is used.
+    , digramIndex :: M.Map (a, a) (Symbol a)        -- An index from a digram pair to the
+                                                    -- place it's used in the grammar.
     }
 
 -- | This serializes a 
 
 -- | This returns a new, empty compressor.
 init :: Compressor a
-init = Compressor M.empty 0
+init = Compressor M.empty 0 M.empty M.empty
 
 -- | This compresses an input sequence and returns the Compressor.
 compress :: Eq a => [a] -> Compressor a