Browse Source

clean up code

pull/1/head
wes 7 years ago
parent
commit
372ce4229e
  1. 12
      suffixes.hs

12
suffixes.hs

@ -17,11 +17,13 @@ data Trie = TBranch {
compress t@(TBranch root []) = t
compress (TBranch root children)
| length children == 1 =
let compressed = (compress $ head children)
in TBranch (root++(getRoot compressed)) (getChildren compressed)
| otherwise = TBranch root (map compress children)
compress (TBranch root (child:[])) =
let compressed = compress child
in TBranch
(root++(getRoot compressed))
(getChildren compressed)
compress (TBranch root children) = TBranch root (map compress children)
notEmpty [] = False
notEmpty _ = True

Loading…
Cancel
Save