TernaryTrees-0.1.0.0: Efficient pure ternary tree Sets and Maps

Data.Map.TernaryMap

Synopsis

Documentation

data TernaryMap a b Source

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

Instances

Functor (TernaryMap a) 
Eq a => Eq (TernaryMap a b) 
(Show a, Show b) => Show (TernaryMap a b) 
(Binary a, Binary b) => Binary (TernaryMap a b)

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

insert :: Ord a => [a] -> b -> TernaryMap a b -> TernaryMap a bSource

Inserts an entrie into a tree. Values with the same key will be replaced with the newer value.

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

member :: Ord a => [a] -> TernaryMap a b -> BoolSource

Returns true if the `[a]` is a key in the TernaryMap.

size :: TernaryMap a b -> IntSource

Counts how many entries there are in the tree.