File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1757,15 +1757,15 @@ iscanl :: (Vector v a, Vector v b) => (Int -> a -> b -> a) -> a -> v b -> v a
1757
1757
{-# INLINE iscanl #-}
1758
1758
iscanl f z =
1759
1759
unstream
1760
- . inplace (S. scanl (\ a (i, b) -> f i a b) z . S. indexed) id
1760
+ . inplace (S. scanl (\ a (i, b) -> f i a b) z . S. indexed) ( + 1 )
1761
1761
. stream
1762
1762
1763
1763
-- | /O(n)/ Scan over a vector (strictly) with its index
1764
1764
iscanl' :: (Vector v a , Vector v b ) => (Int -> a -> b -> a ) -> a -> v b -> v a
1765
1765
{-# INLINE iscanl' #-}
1766
1766
iscanl' f z =
1767
1767
unstream
1768
- . inplace (S. scanl' (\ a (i, b) -> f i a b) z . S. indexed) id
1768
+ . inplace (S. scanl' (\ a (i, b) -> f i a b) z . S. indexed) ( + 1 )
1769
1769
. stream
1770
1770
1771
1771
@@ -1822,18 +1822,22 @@ scanr' f z = unstreamR . Bundle.scanl' (flip f) z . streamR
1822
1822
-- | /O(n)/ Right-to-left scan over a vector with its index
1823
1823
iscanr :: (Vector v a , Vector v b ) => (Int -> a -> b -> b ) -> b -> v a -> v b
1824
1824
{-# INLINE iscanr #-}
1825
- iscanr f z =
1825
+ iscanr f z v =
1826
1826
unstreamR
1827
- . inplace (S. scanl (flip $ uncurry f) z . S. indexed) id
1827
+ . inplace (S. scanl (flip $ uncurry f) z . S. indexedR n) ( + 1 )
1828
1828
. streamR
1829
+ $ v
1830
+ where n = length v
1829
1831
1830
1832
-- | /O(n)/ Right-to-left scan over a vector (strictly) with its index
1831
1833
iscanr' :: (Vector v a , Vector v b ) => (Int -> a -> b -> b ) -> b -> v a -> v b
1832
1834
{-# INLINE iscanr' #-}
1833
- iscanr' f z =
1835
+ iscanr' f z v =
1834
1836
unstreamR
1835
- . inplace (S. scanl' (flip $ uncurry f) z . S. indexed) id
1837
+ . inplace (S. scanl' (flip $ uncurry f) z . S. indexedR n) ( + 1 )
1836
1838
. streamR
1839
+ $ v
1840
+ where n = length v
1837
1841
1838
1842
-- | /O(n)/ Right-to-left scan over a non-empty vector
1839
1843
scanr1 :: Vector v a => (a -> a -> a ) -> v a -> v a
You can’t perform that action at this time.
0 commit comments