forked from GitHub/gf-core
Added a collapse function to Trie
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
module RedBlack (
|
||||
emptyTree,
|
||||
isEmpty,
|
||||
Tree,
|
||||
lookupTree,
|
||||
insertTree,
|
||||
@@ -32,6 +33,10 @@ balance color a x b = T color a x b
|
||||
emptyTree :: Tree key el
|
||||
emptyTree = E
|
||||
|
||||
isEmpty :: Tree key el -> Bool
|
||||
isEmpty (E) = True
|
||||
isEmpty _ = False
|
||||
|
||||
lookupTree :: Ord a => a -> Tree a b -> Maybe b
|
||||
lookupTree _ E = Nothing
|
||||
lookupTree x (T _ a (y,z) b)
|
||||
|
||||
Reference in New Issue
Block a user