@@ -13,7 +13,7 @@ module Streamly.Internal.Data.Stream.Top
1313 -- * Transformation
1414 -- ** Sampling
1515 -- | Value agnostic filtering.
16− sampleFromThen
16+ strideFromThen
1717
1818 -- ** Reordering
1919 , sortBy
@@ -78,18 +78,18 @@ import Prelude hiding (filter, zipWith, concatMap, concat)
7878
7979-- XXX We can implement this using addition instead of "mod" to make it more
8080-- efficient.
81−--
82−-- | @sampleFromthen offset stride@ samples the element at @offset@ index and
81+
82+-- | @strideFromthen offset stride@ takes the element at @offset@ index and
8383-- then every element at strides of @stride@.
8484--
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
8686-- [2,5,8]
8787--
8888-- /Pre-release/
8989--
90−{-# INLINE sampleFromThen #-}
91−sampleFromThen :: Monad m => Int -> Int -> Stream m a -> Stream m a
92−sampleFromThen offset stride =
90+{-# INLINE strideFromThen #-}
91+strideFromThen :: Monad m => Int -> Int -> Stream m a -> Stream m a
92+strideFromThen offset stride =
9393 Stream.with Stream.indexed Stream.filter
9494 (\(i, _) -> i >= offset && (i - offset) `mod` stride == 0)
9595