Analog of mapAccumL for lists. Note that in contrast to
mapAccumL, the function argument takes the accumulator as its
second argument, not its first argument, and the accumulated value is
strict.
Subject to fusion
Since 1.1.1
Consume a source with a strict accumulator, in a way piecewise defined
by a controlling stream. The latter will be evaluated until it
terminates.
>>> let f a s = liftM (:s) $ mapC (*a) =$ CL.take a
>>> reverse $ runIdentity $ yieldMany [0..3] $$ mapAccumS f [] (yieldMany [1..])
[[],[1],[4,6],[12,15,18]] :: [[Int]]
mapWhileC with a break condition dependent on a strict
accumulator. Equivalently, mapAccum as long as the result is
Right. Instead of producing a leftover, the breaking input
determines the resulting accumulator via Left.
mapWhile with a break condition dependent on a strict
accumulator. Equivalently, mapAccum as long as the result is
Right. Instead of producing a leftover, the breaking input
determines the resulting accumulator via Left.
Subject to fusion