scanr package:bytestring

scanr is similar to foldr, but returns a list of successive reduced values from the right.
scanr f z [..., x{n-1}, xn] == [..., x{n-1} `f` (xn `f` z), xn `f` z, z]
Note that
head (scanr f z xs) == foldr f z xs
last (scanr f z xs) == z
scanr is the right-to-left dual of scanl.
scanr is similar to foldr, but returns a list of successive reduced values from the right.
scanr f z [..., x{n-1}, xn] == [..., x{n-1} `f` (xn `f` z), xn `f` z, z]
Note that
head (scanr f z xs) == foldr f z xs
last (scanr f z xs) == z
scanr1 is a variant of scanr that has no starting value argument.
scanr1 is a variant of scanr that has no starting value argument.