vector-circular 0.1.2 → 0.1.3
raw patch · 3 files changed
+30/−3 lines, 3 files
Files
- src/Data/Vector/Circular.hs +14/−1
- src/Data/Vector/Circular/Generic.hs +15/−1
- vector-circular.cabal +1/−1
src/Data/Vector/Circular.hs view
@@ -206,7 +206,7 @@ ,foldl, foldr1, foldl1, all, any, and, or, sum ,product, maximum, minimum, concatMap ,zipWith, zipWith3, zip, zip3, replicate, enumFromTo- ,enumFromThenTo, (++))+ ,enumFromThenTo, (++), filter) import Language.Haskell.TH.Syntax import qualified Data.Foldable as Foldable import qualified Data.Semigroup.Foldable.Class as Foldable1@@ -1651,6 +1651,19 @@ -- elemIndices :: Eq a => a -> CircularVector a -> Vector Int elemIndices a = NonEmpty.elemIndices a . toNonEmptyVector++-- | /O(n)/ Drop elements that do not satisfy the predicate.+--+-- If no elements satisfy the predicate, the resulting vector may be empty.+--+-- >>> filter (\a -> if a == 2 then False else True) (unsafeFromList [1..3])+-- [1,3]+--+-- >>> filter (const False) (unsafeFromList [1..3])+-- []+--+filter :: (a -> Bool) -> CircularVector a -> Vector a+filter f = NonEmpty.filter f . toNonEmptyVector -- | /O(n)/ Drop elements that do not satisfy the predicate which is -- applied to values and their indices.
src/Data/Vector/Circular/Generic.hs view
@@ -202,7 +202,7 @@ ,foldl, foldr1, foldl1, all, any, and, or, sum ,product, maximum, minimum, concatMap ,zipWith, zipWith3, zip, zip3, replicate, enumFromTo- ,enumFromThenTo, (++))+ ,enumFromThenTo, (++), filter) import Language.Haskell.TH.Syntax import qualified Data.Vector.Mutable as MVector import qualified Data.Vector.NonEmpty as NonEmpty@@ -1667,6 +1667,20 @@ -- elemIndices :: (G.Vector v a, G.Vector v Int, Eq a) => a -> CircularVector v a -> v Int elemIndices a = G.elemIndices a . toVector++-- | /O(n)/ Drop elements that do not satisfy the predicate.+--+-- If no elements satisfy the predicate, the resulting vector may be empty.+--+-- >>> filter (\a -> if a == 2 then False else True) (unsafeFromList @Vector [1..3])+-- [1,3]+--+-- >>> filter (const False) (unsafeFromList @Vector [1..3])+-- []+--+filter :: G.Vector v a => (a -> Bool) -> CircularVector v a -> v a+filter f = G.filter f . toVector+ -- | /O(n)/ Drop elements that do not satisfy the predicate which is -- applied to values and their indices.
vector-circular.cabal view
@@ -2,7 +2,7 @@ name: vector-circular version:- 0.1.2+ 0.1.3 synopsis: circular vectors description: