- data Elem2 a b
- data TernaryMap a b
- = TNode !(Elem2 a b) !(TernaryMap a b) !(TernaryMap a b) !(TernaryMap a b)
- | TEnd
- insert' :: Ord a => [a] -> b -> TernaryMap a b
- insert :: Ord a => [a] -> b -> TernaryMap a b -> TernaryMap a b
- isKey :: Ord a => [a] -> TernaryMap a b -> Bool
- treeSize :: TernaryMap a b -> Int
- numEntries :: TernaryMap a b -> Int
- fromList :: Ord a => [([a], b)] -> TernaryMap a b
Documentation
Elem2 a b is used to hold elements of a list after insertion, and indicate that we've reached the end of the list.
data TernaryMap a b Source
TernaryMap a b is ternary tree. It is commonly used for storing word lists like dictionaries.
TNode !(Elem2 a b) !(TernaryMap a b) !(TernaryMap a b) !(TernaryMap a b) | |
TEnd |
Eq a => Eq (TernaryMap a b) | |
(Show a, Show b) => Show (TernaryMap a b) | |
(Binary a, Binary b) => Binary (TernaryMap a b) | This binary instance saves some space by making special cases of some commonly encountered structures in the trees. |
insert' :: Ord a => [a] -> b -> TernaryMap a bSource
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] -> b -> TernaryMap a b -> TernaryMap a bSource
Inserts an entries into a tree.
isKey :: Ord a => [a] -> TernaryMap a b -> BoolSource
Returns true if the `[a]` is in the TernaryMap
treeSize :: TernaryMap a b -> IntSource
Returns the number of non-Val Elems
numEntries :: TernaryMap a b -> IntSource
Counts how many entries there are in the tree.
fromList :: Ord a => [([a], b)] -> TernaryMap a bSource
Creates a new tree from a list of strings