TernaryTrees- Efficient pure ternary tree Sets and Maps




data StringSet Source

StringSet is ternary tree. It is commonly used for storing word lists like dictionaries for spell checking etc.


Eq StringSet 
Show StringSet 
Binary StringSet

A rather long Binary instance, that uses binary numbers to indicate where Ends are efficiently.

insert :: String -> StringSet -> StringSetSource

Inserts a new list of elements into a tree.

singleton :: String -> StringSetSource

Quickly build an initial tree.

member :: String -> StringSet -> BoolSource

Returns true if the string is in the StringSet

size :: StringSet -> IntSource

Counts how many entries there are in the tree.

fromList :: [String] -> StringSetSource

Creates a new tree from a list of strings

null :: StringSet -> BoolSource

Returns true if the set is empty.

elems :: StringSet -> [String]Source

Returns a (sorted) list of all strings inserted into the set.

 (elems . fromList) xs == (nub . sort) xs