packages feed

TernaryTrees 0.0.2.2 → 0.0.3.0

raw patch · 2 files changed

+23/−11 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Map.TernaryMap: getVal :: (Ord a) => [a] -> TernaryMap a b -> Maybe b

Files

Data/Map/TernaryMap.hs view
@@ -70,6 +70,16 @@         EQ -> isKey  xs e         GT -> isKey xss h +getVal :: Ord a => [a] -> TernaryMap a b -> Maybe b+getVal _ TEnd = Nothing+getVal [] (TNode (Val b) _ _ _) = Just b+getVal [] (TNode ele l _ _)     = getVal [] l+getVal xss@(x:xs) (TNode ele l e h) =+    case compare (C x) ele of+        LT -> getVal xss l+        EQ -> getVal  xs e+        GT -> getVal xss h+ -- | Returns the number of non-Val Elems treeSize :: TernaryMap a b -> Int treeSize TEnd = 0
TernaryTrees.cabal view
@@ -1,28 +1,30 @@ Name:                   TernaryTrees-Version:                0.0.2.2+Version:                0.0.3.0 Category:               Data Structures Synopsis:               Efficient pure ternary tree Sets and Maps Description:            Ternary trees are an efficient structure often used for storing 			strings for fast lookups. This package implements a generic tree 			for storing lists of Ord instances, and a specialised String-			implementation which is about 30% faster than the generic version.\-			+			implementation which is about 30% faster than the generic version.+			. 			An example program is provided what shows how to use the package 			as a dictionary program for spell checking, and how it can be -			used to serialise data with Don Stewart's Data.Binary package.\-			+			used to serialise data with Don Stewart's Data.Binary package.+			. 			From my testing, using the /usr/shart/dict/words file on my system 			(over 230,000 words), inserting all words, checking they all exist 			in the tree, writing them to a binary file, reading them back in 			and checking the read in result is the same as the original takes 			slightly over 3 seconds using the StringSet. The written file is  			also slightly smaller than the input (by about 10% for shuffled data,-			and 7% for in order data).\-			-			New in this version: \-			\-			    * Added Data.Map.TernaryMap\-			    * (Hopefully fixed this .cabal file) +			and 7% for in order data).+			.+			New in this version:+			.+			* Added the all important getVal function to Data.Map.TernaryMap.+			* (Hopefully fixed this .cabal file again).+			.+			&#169; 2009 by Alex Mason (<http://axman6.homeip.net/blog/>); BSD3 license. 			 License:                BSD3 License-file:           LICENSE.txt