úÎ!øüø—      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–(c) Twan van Laarhoven 2008 BSD-stylelibraries@haskell.org provisionalportableSafe12‚bEmultiset'The number of occurrences of an elementmultisetA multiset of values a-. The same value can occur multiple times.multisetO(n+m). See .multisetO(1). Is this the empty multiset?multisetO(n)). The number of elements in the multiset.multisetO(1)2. The number of distinct elements in the multiset.multisetO(log n)!. Is the element in the multiset?multisetO(log n)%. Is the element not in the multiset?multisetO(log n)8. The number of occurrences of an element in a multiset. multisetO(1). The empty mutli set. multisetO(1). Create a singleton mutli set. multisetO(log n)". Insert an element in a multiset. multisetO(log n):. Insert an element in a multiset a given number of times.9Negative numbers remove occurrences of the given element. multisetO(log n)*. Delete a single element from a multiset.multisetO(log n)<. Delete an element from a multiset a given number of times.6Negative numbers add occurrences of the given element.multisetO(log n)7. Delete all occurrences of an element from a multiset.multisetO(n+m)8. Is this a proper subset? (ie. a subset but not equal).multisetO(n+m). Is this a subset? (s1 `isSubsetOf` s2) tells whether s1 is a subset of s2.multisetO(log n)$. The minimal element of a multiset.multisetO(log n)$. The maximal element of a multiset.multisetO(log n). Delete the minimal element.multisetO(log n). Delete the maximal element.multisetO(log n)0. Delete all occurrences of the minimal element.multisetO(log n)0. Delete all occurrences of the maximal element.multisetO(log n)&. Delete and find the minimal element. 0deleteFindMin set = (findMin set, deleteMin set)multisetO(log n)&. Delete and find the maximal element. 0deleteFindMax set = (findMax set, deleteMax set)multisetO(log n)f. Retrieves the minimal element of the multiset, and the set with that element removed. Returns Nothing when passed an empty multiset. Examples:'minView $ fromList ['a', 'a', 'b', 'c']2Just ('a',fromOccurList [('a',1),('b',1),('c',1)])multisetO(log n)f. Retrieves the maximal element of the multiset, and the set with that element removed. Returns Nothing when passed an empty multiset. Examples:'maxView $ fromList ['a', 'a', 'b', 'c']*Just ('c',fromOccurList [('a',2),('b',1)])multiset#The union of a list of multisets: ( == —   ).multisetO(n+m)F. The union of two multisets. The union adds the occurrences together.&The implementation uses the efficient  hedge-union6 algorithm. Hedge-union is more efficient on (bigset  smallset).multisetO(n+m)©. The union of two multisets. The number of occurrences of each element in the union is the maximum of the number of occurrences in the arguments (instead of the sum).&The implementation uses the efficient  hedge-union6 algorithm. Hedge-union is more efficient on (bigset  smallset).multisetO(n+m)F. Difference of two multisets. The implementation uses an efficient hedge algorithm comparable with  hedge-union. multisetO(n+m)i. The intersection of two multisets. Elements of the result come from the first multiset, so for example ÿ import qualified Data.MultiSet as MS data AB = A | B deriving Show instance Ord AB where compare _ _ = EQ instance Eq AB where _ == _ = True main = print (MS.singleton A `MS.intersection` MS.singleton B, MS.singleton B `MS.intersection` MS.singleton A)prints (fromList [A],fromList [B]).!multisetO(n)1. Filter all elements that satisfy the predicate."multisetO(n)¥. Partition the multiset into two multisets, one with all elements that satisfy the predicate and one with all elements that don't satisfy the predicate. See also >.#multiset O(n*log n). # f s& is the multiset obtained by applying f to each element of s.$multisetO(n). $ f s == # f s, but works only when f is strictly monotonic.  The precondition is not checked. Semi-formally, we have: xand [x < y ==> f x < f y | x <- ls, y <- ls] ==> mapMonotonic f s == map f s where ls = toList s%multisetO(n). Map and collect the ˜ results.&multisetO(n). Map and separate the ™ and š results.'multisetO(n)E. Apply a function to each element, and take the union of the results(multisetO(n)E. Apply a function to each element, and take the union of the results)multisetO(n)). The monad join operation for multisets.*multisetO(n)1. The monad bind operation, (>>=), for multisets.+multisetO(t)?. Fold over the elements of a multiset in an unspecified order.›multisetO(t). Post-order fold.,multisetO(n)>. Fold over the elements of a multiset with their occurrences.-multisetO(t). The elements of a multiset..multisetO(n)Q. The distinct elements of a multiset, each element occurs only once in the list. %distinctElems = map fst . toOccurList/multisetO(t)-. Convert the multiset to a list of elements.0multisetO(t)8. Convert the multiset to an ascending list of elements.1multiset O(t*log t),. Create a multiset from a list of elements.2multisetO(t);. Build a multiset from an ascending list in linear time. :The precondition (input list is ascending) is not checked.3multisetO(n)P. Build a multiset from an ascending list of distinct elements in linear time. CThe precondition (input list is strictly ascending) is not checked.4multisetO(n)=. Convert the multiset to a list of element/occurrence pairs.5multisetO(n)H. Convert the multiset to an ascending list of element/occurrence pairs.6multiset O(n*log n)]. Create a multiset from a list of element/occurrence pairs. Occurrences must be positive. 6The precondition (all occurrences > 0) is not checked.7multisetO(n)v. Build a multiset from an ascending list of element/occurrence pairs in linear time. Occurrences must be positive. OThe precondition (input list is ascending, all occurrences > 0) is not checked.8multisetO(n)Ž. Build a multiset from an ascending list of elements/occurrence pairs where each elements appears only once. Occurrences must be positive. XThe precondition (input list is strictly ascending, all occurrences > 0) is not checked.9multisetO(1). Convert a multiset to a œ( from elements to number of occurrences.:multisetO(n) . Convert a œ, from elements to occurrences to a multiset.;multisetO(1) . Convert a œ? from elements to occurrences to a multiset. Assumes that the œ) contains only values larger than zero. 3The precondition (all elements > 0) is not checked.<multisetO(n). Convert a multiset to a , removing duplicates.=multisetO(n) . Convert a  to a multiset.>multisetO(log n). The expression (> x set ) is a pair  (set1,set2) where all elements in set1 are lower than x and all elements in set2 larger than x. x is not found in neither set1 nor set2.?multisetO(log n) . Performs a >V but also returns the number of occurrences of the pivot element in the original set.@multisetO(n)\. Show the tree that implements the set. The tree is shown in a compressed, hanging format.AmultisetO(n). The expression (showTreeWith hang wide map.) shows the tree that implements the set. If hang is True, a hanging6 tree is shown otherwise a rotated tree is shown. If wide is ž!, an extra wide version is shown. ÿŸSet> putStrLn $ showTreeWith True False $ fromDistinctAscList [1,1,2,3,4,5] (1*) 4 +--(1*) 2 | +--(2*) 1 | +--(1*) 3 +--(1*) 5 Set> putStrLn $ showTreeWith True True $ fromDistinctAscList [1,1,2,3,4,5] (1*) 4 | +--(1*) 2 | | | +--(2*) 1 | | | +--(1*) 3 | +--(1*) 5 Set> putStrLn $ showTreeWith False True $ fromDistinctAscList [1,1,2,3,4,5] +--(1*) 5 | (1*) 4 | | +--(1*) 3 | | +--(1*) 2 | +--(2*) 1BmultisetO(n)3. Test if the internal multiset structure is valid.Imultiset Note that Ÿ is slower than .C  !"#$%&'()*+,-./0123456789:;<=>?@ABC  !">?#$%&'(*)+,-./1023456789:;<=@AB9 (c) Twan van Laarhoven 2008 BSD-stylelibraries@haskell.org provisionalportableSafe12úÉFLmultiset'The number of occurrences of an elementMmultisetKey type for IntMultiSetNmultisetCA multiset of integers. The same value can occur multiple times.OmultisetO(n+m). See l.PmultisetO(1). Is this the empty multiset?QmultisetO(n)). The number of elements in the multiset.RmultisetO(1)2. The number of distinct elements in the multiset.Smultiset O(min(n,W))!. Is the element in the multiset?Tmultiset O(min(n,W))%. Is the element not in the multiset?Umultiset O(min(n,W))8. The number of occurrences of an element in a multiset.VmultisetO(1). The empty mutli set.WmultisetO(1). Create a singleton mutli set.Xmultiset O(min(n,W))". Insert an element in a multiset.Ymultiset O(min(n,W)):. Insert an element in a multiset a given number of times.9Negative numbers remove occurrences of the given element.Zmultiset O(min(n,W))*. Delete a single element from a multiset.[multiset O(min(n,W))<. Delete an element from a multiset a given number of times.6Negative numbers add occurrences of the given element.\multiset O(min(n,W))7. Delete all occurrences of an element from a multiset.]multisetO(n+m)8. Is this a proper subset? (ie. a subset but not equal).^multisetO(n+m). Is this a subset? (s1 `isSubsetOf` s2) tells whether s1 is a subset of s2. multisetO(log n). The minimal key of an IntMap.¡multisetO(log n). The maximal key of an IntMap._multisetO(log n)$. The minimal element of a multiset.`multisetO(log n)$. The maximal element of a multiset.amultisetO(log n). Delete the minimal element.bmultisetO(log n). Delete the maximal element.cmultisetO(log n)0. Delete all occurrences of the minimal element.dmultisetO(log n)0. Delete all occurrences of the maximal element.emultisetO(log n)&. Delete and find the minimal element. 0deleteFindMin set = (findMin set, deleteMin set)fmultisetO(log n)&. Delete and find the maximal element. 0deleteFindMax set = (findMax set, deleteMax set)gmultisetO(log n)a. Retrieves the minimal element of the multiset, and the set stripped from that element Returns Nothing when passed an empty multiset. Examples:'minView $ fromList [100, 100, 200, 300]2Just (100,fromOccurList [(100,1),(200,1),(300,1)])hmultisetO(log n)Y. Retrieves the maximal element of the multiset, and the set stripped from that element fail/s (in the monad) when passed an empty multiset. Examples:'maxView $ fromList [100, 100, 200, 300]*Just (300,fromOccurList [(100,2),(200,1)])imultiset#The union of a list of multisets: (i == — j V).jmultisetO(n+m)F. The union of two multisets. The union adds the occurrences together.&The implementation uses the efficient  hedge-union6 algorithm. Hedge-union is more efficient on (bigset j smallset).kmultisetO(n+m)©. The union of two multisets. The number of occurrences of each element in the union is the maximum of the number of occurrences in the arguments (instead of the sum).&The implementation uses the efficient  hedge-union6 algorithm. Hedge-union is more efficient on (bigset j smallset).lmultisetO(n+m)F. Difference of two multisets. The implementation uses an efficient hedge algorithm comparable with  hedge-union.mmultisetO(n+m)$. The intersection of two multisets.prints (fromList [A],fromList [B]).nmultisetO(n)1. Filter all elements that satisfy the predicate.omultisetO(n)¥. Partition the multiset into two multisets, one with all elements that satisfy the predicate and one with all elements that don't satisfy the predicate. See also ‹.pmultiset O(n*log n). p f s& is the multiset obtained by applying f to each element of s.qmultisetO(n). q f s == p f s, but works only when f is strictly monotonic.  The precondition is not checked. Semi-formally, we have: xand [x < y ==> f x < f y | x <- ls, y <- ls] ==> mapMonotonic f s == map f s where ls = toList srmultisetO(n). Map and collect the ˜ results.smultisetO(n). Map and separate the ™ and š results.tmultisetO(n)E. Apply a function to each element, and take the union of the resultsumultisetO(n)E. Apply a function to each element, and take the union of the resultsvmultisetO(n)). The monad join operation for multisets.wmultisetO(n)1. The monad bind operation, (>>=), for multisets.xmultisetO(t)?. Fold over the elements of a multiset in an unspecified order.¢multisetO(t). Post-order fold.ymultisetO(n)>. Fold over the elements of a multiset with their occurrences.zmultisetO(t). The elements of a multiset.{multisetO(n)Q. The distinct elements of a multiset, each element occurs only once in the list. %distinctElems = map fst . toOccurList|multisetO(t)-. Convert the multiset to a list of elements.}multisetO(t)8. Convert the multiset to an ascending list of elements.~multiset O(t*min(n,W)),. Create a multiset from a list of elements.multisetO(t);. Build a multiset from an ascending list in linear time. :The precondition (input list is ascending) is not checked.€multisetO(n)P. Build a multiset from an ascending list of distinct elements in linear time. CThe precondition (input list is strictly ascending) is not checked.multisetO(n)=. Convert the multiset to a list of element/occurrence pairs.‚multisetO(n)H. Convert the multiset to an ascending list of element/occurrence pairs.ƒmultiset O(n*min(n,W))]. Create a multiset from a list of element/occurrence pairs. Occurrences must be positive. 6The precondition (all occurrences > 0) is not checked.„multisetO(n)v. Build a multiset from an ascending list of element/occurrence pairs in linear time. Occurrences must be positive. OThe precondition (input list is ascending, all occurrences > 0) is not checked.…multisetO(n)Ž. Build a multiset from an ascending list of elements/occurrence pairs where each elements appears only once. Occurrences must be positive. XThe precondition (input list is strictly ascending, all occurrences > 0) is not checked.†multisetO(1). Convert a multiset to an £( from elements to number of occurrences.‡multisetO(n) . Convert an £, from elements to occurrences to a multiset.ˆmultisetO(1) . Convert an £? from elements to occurrences to a multiset. Assumes that the £) contains only values larger than zero. 3The precondition (all elements > 0) is not checked.‰multisetO(n). Convert a multiset to an £, removing duplicates.ŠmultisetO(n) . Convert an £ to a multiset.‹multisetO(log n). The expression (‹ x set ) is a pair  (set1,set2) where all elements in set1 are lower than x and all elements in set2 larger than x. x is not found in neither set1 nor set2.ŒmultisetO(log n) . Performs a ‹V but also returns the number of occurrences of the pivot element in the original set.multisetO(n)\. Show the tree that implements the set. The tree is shown in a compressed, hanging format.ŽmultisetO(n). The expression (showTreeWith hang wide map.) shows the tree that implements the set. If hang is True, a hanging6 tree is shown otherwise a rotated tree is shown. If wide is ž!, an extra wide version is shown. ÿŸSet> putStrLn $ showTreeWith True False $ fromDistinctAscList [1,1,2,3,4,5] (1*) 4 +--(1*) 2 | +--(2*) 1 | +--(1*) 3 +--(1*) 5 Set> putStrLn $ showTreeWith True True $ fromDistinctAscList [1,1,2,3,4,5] (1*) 4 | +--(1*) 2 | | | +--(2*) 1 | | | +--(1*) 3 | +--(1*) 5 Set> putStrLn $ showTreeWith False True $ fromDistinctAscList [1,1,2,3,4,5] +--(1*) 5 | (1*) 4 | | +--(1*) 3 | | +--(1*) 2 | +--(2*) 1CLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽCNMLOPQRSTU^]VWXYZ[\jiklmno‹Œpqrstuwvxy_`abcdefhgz{|~}€‚ƒ„…†‡ˆ‰ŠŽO9 ¤      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP      !"#$%&'()*+,-./0123456789:;<=>?@ABCDQRSTUVWXYZ[Y\]Y^_Y^`abcdbefghiYZjklabmno'multiset-0.3.4.3-FBdHS3dhnKQ8hxlVNr5Pqo Data.MultiSetData.IntMultiSetOccurMultiSet\\nullsize distinctSizemember notMemberoccurempty singletoninsert insertManydelete deleteMany deleteAllisProperSubsetOf isSubsetOffindMinfindMax deleteMin deleteMax deleteMinAll deleteMaxAll deleteFindMin deleteFindMaxminViewmaxViewunionsunionmaxUnion difference intersectionfilter partitionmap mapMonotonicmapMaybe mapEither concatMap unionsMapjoinbindfold foldOccurelems distinctElemstoList toAscListfromList fromAscListfromDistinctAscList toOccurListtoAscOccurList fromOccurListfromAscOccurListfromDistinctAscOccurListtoMapfromMap fromOccurMaptoSetfromSetsplit splitOccurshowTree showTreeWithvalid$fReadMultiSet$fShowMultiSet $fOrdMultiSet $fEqMultiSet$fDataMultiSet$fNFDataMultiSet$fFoldableMultiSet$fSemigroupMultiSet$fMonoidMultiSetKey IntMultiSet$fReadIntMultiSet$fShowIntMultiSet$fOrdIntMultiSet$fEqIntMultiSet$fDataIntMultiSet$fNFDataIntMultiSet$fSemigroupIntMultiSet$fMonoidIntMultiSetbase Data.Foldablefoldl GHC.MaybeJust Data.EitherLeftRightfoldrcontainers-0.6.0.1Data.Map.InternalMapData.Set.InternalSetghc-prim GHC.TypesTrueelemminKeymaxKeyData.IntMap.InternalIntMap