- data Elem a
- data TernarySet a
- = TNode !(Elem a) !(TernarySet a) !(TernarySet a) !(TernarySet a)
- | TEnd

- insert' :: Ord a => [a] -> TernarySet a
- insert :: Ord a => [a] -> TernarySet a -> TernarySet a
- isElem :: Ord a => [a] -> TernarySet a -> Bool
- treeSize :: TernarySet a -> Int
- numEntries :: TernarySet a -> Int
- fromList :: Ord a => [[a]] -> TernarySet a

# Documentation

Elem a is used to hold elements of a list after insertion, and indicate that we've reached the end of the list.

data TernarySet a Source

TernarySet a is ternary tree. It is commonly used for storing word lists like dictionaries.

TNode !(Elem a) !(TernarySet a) !(TernarySet a) !(TernarySet a) | |

TEnd |

Eq a => Eq (TernarySet a) | |

Show a => Show (TernarySet a) | |

Binary a => Binary (TernarySet a) | This binary instance saves some space by making special cases of some commonly encountered structures in the trees. |

insert' :: Ord a => [a] -> TernarySet aSource

Quickly build a tree without an initial tree. This should be used to create an initial tree, using insert there after.

insert :: Ord a => [a] -> TernarySet a -> TernarySet aSource

Inserts an entries into a tree.

isElem :: Ord a => [a] -> TernarySet a -> BoolSource

Returns true if the `[a]` is in the TernarySet

treeSize :: TernarySet a -> IntSource

Returns the number of non-Null Elems

numEntries :: TernarySet a -> IntSource

Counts how many entries there are in the tree.

fromList :: Ord a => [[a]] -> TernarySet aSource

Creates a new tree from a list of `strings`