@@ -13,7 +13,7 @@ module Streamly.Internal.Data.Stream.Top
13 -- * Transformation
13 -- * Transformation
14 -- ** Sampling
14 -- ** Sampling
15 -- | Value agnostic filtering.
15 -- | Value agnostic filtering.
16− sampleFromThen
16+ strideFromThen
18 -- ** Reordering
18 -- ** Reordering
@@ -78,18 +78,18 @@ import Prelude hiding (filter, zipWith, concatMap, concat)
79-- XXX We can implement this using addition instead of "mod" to make it more
79-- XXX We can implement this using addition instead of "mod" to make it more
80-- efficient.
80-- efficient.
82−-- | @sampleFromthen offset stride@ samples the element at @offset@ index and
82+-- | @strideFromthen offset stride@ takes the element at @offset@ index and
83-- then every element at strides of @stride@.
83-- then every element at strides of @stride@.
85−-- >>> Stream.fold Fold.toList $ Stream.sampleFromThen 2 3 $ Stream.enumerateFromTo 0 10
85+-- >>> Stream.fold Fold.toList $ Stream.strideFromThen 2 3 $ Stream.enumerateFromTo 0 10
88-- /Pre-release/
88-- /Pre-release/
90−{-# INLINE sampleFromThen #-}
90+{-# INLINE strideFromThen #-}
91−sampleFromThen :: Monad m => Int -> Int -> Stream m a -> Stream m a
91+strideFromThen :: Monad m => Int -> Int -> Stream m a -> Stream m a
92−sampleFromThen offset stride =
92+strideFromThen offset stride =
93 Stream.with Stream.indexed Stream.filter
93 Stream.with Stream.indexed Stream.filter
94 (\(i, _) -> i >= offset && (i - offset) `mod` stride == 0)
94 (\(i, _) -> i >= offset && (i - offset) `mod` stride == 0)