head (scanr f z xs) == foldr f z xs.
>>> scanr (+) 0 [1..4] [10,9,7,4,0]
>>> scanr (+) 42 [] [42]
>>> scanr (-) 100 [1..4] [98,-97,99,-96,100]
>>> scanr (\nextChar reversedString -> nextChar : reversedString) "foo" ['a', 'b', 'c', 'd'] ["abcdfoo","bcdfoo","cdfoo","dfoo","foo"]
>>> force $ scanr (+) 0 [1..] *** Exception: stack overflow
head (scanr f z xs) == foldr f z xs.
>>> scanr (+) 0 [1..4] [10,9,7,4,0] >>> scanr (+) 42 [] [42] >>> scanr (-) 100 [1..4] [98,-97,99,-96,100] >>> scanr (\nextChar reversedString -> nextChar : reversedString) "foo" ['a', 'b', 'c', 'd'] ["abcdfoo","bcdfoo","cdfoo","dfoo","foo"] >>> force $ scanr (+) 0 [1..] *** Exception: stack overflow