multiset-comb 0.2.1 → 0.2.2
raw patch · 2 files changed
+14/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Math.Combinatorics.Multiset: emptyMS :: Multiset a
+ Math.Combinatorics.Multiset: singletonMS :: a -> Multiset a
Files
- Math/Combinatorics/Multiset.hs +12/−1
- multiset-comb.cabal +2/−2
Math/Combinatorics/Multiset.hs view
@@ -11,6 +11,7 @@ Count , Multiset(..)+ , emptyMS, singletonMS , consMS, (+:) -- ** Conversions@@ -82,11 +83,21 @@ liftMS :: ([(a, Count)] -> [(b, Count)]) -> Multiset a -> Multiset b liftMS f (MS m) = MS (f m) +-- | A multiset with no values in it.+emptyMS :: Multiset a+emptyMS = MS []++-- | Create a multiset with only a single value in it.+singletonMS :: a -> Multiset a+singletonMS a = MS [(a,1)]+ -- | Add an element with multiplicity to a multiset. Precondition: -- the new element is distinct from all elements already in the -- multiset. consMS :: (a, Count) -> Multiset a -> Multiset a-consMS e (MS m) = MS (e:m)+consMS e@(_,c) (MS m)+ | c > 0 = MS (e:m)+ | otherwise = MS m -- | A convenient shorthand for 'consMS'. (+:) :: (a, Count) -> Multiset a -> Multiset a
multiset-comb.cabal view
@@ -1,5 +1,5 @@ Name: multiset-comb-Version: 0.2.1+Version: 0.2.2 Synopsis: Combinatorial algorithms over multisets Description: Various combinatorial algorithms over multisets, including generating all permutations,@@ -13,7 +13,7 @@ Copyright: (c) 2010 Brent Yorgey Stability: Experimental Category: Math-Tested-with: GHC ==6.10.4, GHC ==6.12.1+Tested-with: GHC ==6.10.4, GHC ==6.12.1, GHC ==7.0.3 Build-type: Simple Cabal-version: >=1.6 source-repository head