scanl package:rio

scanl is similar to foldl, but returns a list of successive reduced values from the left. This function will fuse.
scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]
Note that
last (scanl f z xs) == foldl f z xs.
scanl is similar to foldl, but returns a list of successive reduced values from the left:
scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]
Note that
last (scanl f z xs) == foldl f z xs.
scanl is similar to foldl, but returns a stream of successive reduced values from the left:
scanl f z [x1, x2, ...] == z :| [z `f` x1, (z `f` x1) `f` x2, ...]
Note that
last (scanl f z xs) == foldl f z xs.
scanl is similar to foldl, but returns a sequence of reduced values from the left:
scanl f z (fromList [x1, x2, ...]) = fromList [z, z `f` x1, (z `f` x1) `f` x2, ...]
O(n) scanl is similar to foldl, but returns a list of successive reduced values from the left. Subject to fusion. Performs replacement on invalid scalar values.
scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]
Note that
last (scanl f z xs) == foldl f z xs.
O(n) Haskell-style scan
scanl f z <x1,...,xn> = <y1,...,y(n+1)>
where y1 = z
yi = f y(i-1) x(i-1)
Example: scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>
O(n) Haskell-style scan
scanl f z <x1,...,xn> = <y1,...,y(n+1)>
where y1 = z
yi = f y(i-1) x(i-1)
Example: scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>
O(n) Haskell-style scan
scanl f z <x1,...,xn> = <y1,...,y(n+1)>
where y1 = z
yi = f y(i-1) x(i-1)
Example: scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>
O(n) Haskell-style scan
scanl f z <x1,...,xn> = <y1,...,y(n+1)>
where y1 = z
yi = f y(i-1) x(i-1)
Example: scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>
scanl1 is a variant of scanl that has no starting value argument. This function will fuse.
scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]
A strictly accumulating version of scanl
scanl1 is a variant of scanl that has no starting value argument:
scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]
scanl1 is a variant of scanl that has no starting value argument:
scanl1 f [x1, x2, ...] == x1 :| [x1 `f` x2, x1 `f` (x2 `f` x3), ...]
scanl1 is a variant of scanl that has no starting value argument:
scanl1 f (fromList [x1, x2, ...]) = fromList [x1, x1 `f` x2, ...]
O(n) scanl1 is a variant of scanl that has no starting value argument. Subject to fusion. Performs replacement on invalid scalar values.
scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]
O(n) Haskell-style scan with strict accumulator
O(n) Haskell-style scan with strict accumulator
O(n) Scan over a non-empty vector
scanl f <x1,...,xn> = <y1,...,yn>
where y1 = x1
yi = f y(i-1) xi
O(n) Scan over a non-empty vector with a strict accumulator
O(n) Scan over a non-empty vector
scanl f <x1,...,xn> = <y1,...,yn>
where y1 = x1
yi = f y(i-1) xi
O(n) Scan over a non-empty vector with a strict accumulator
O(n) Haskell-style scan with strict accumulator
O(n) Scan over a non-empty vector
scanl f <x1,...,xn> = <y1,...,yn>
where y1 = x1
yi = f y(i-1) xi
O(n) Scan over a non-empty vector with a strict accumulator
O(n) Haskell-style scan with strict accumulator