The
mapAccumL function behaves like a combination of
map
and
foldl; it applies a function to each element of a vector,
passing an accumulating parameter from left to right, and returning a
final value of this accumulator together with the new vector.
>>> mapAccumL (\acc x -> (acc + x,acc + 1)) 0 (1 :> 2 :> 3 :> 4 :> Nil)
(10,1 :> 2 :> 4 :> 7 :> Nil)
"
mapAccumL f acc xs" corresponds to the following
circuit layout: