TernaryTrees-0.2.0.2: Efficient pure ternary tree Sets and Maps

Data.Set.TernarySet

Synopsis

Documentation

data TernarySet a Source

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

Instances

Eq a => Eq (TernarySet a) 
Show a => Show (TernarySet a) 
Binary a => Binary (TernarySet a)

This binary uses the fact that the number of Ends can be represented in binary numbers to save a lot of space.

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

Inserts an entries into a tree.

singleton :: 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.

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

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

size :: 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

null :: TernarySet a -> BoolSource

Returns true if the set is empty.

elems :: TernarySet a -> [[a]]Source

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