[Haskell-cafe] Simple list processing
Thomas M. DuBuisson
thomas.dubuisson at gmail.com
Wed Jun 11 16:46:23 EDT 2008
Why is there no mapAccumL' (strict)? Just a library deficiency that we
can remedy or am I missing something?
Don Stewart wrote:
> > OK, so this is a fairly basic question about list processing.
> > Several times now, I have found myself wanting to process a list to
> > produce a new list. However, the way later elements are processed
> > depends on what the earlier elements are - in other words, this isn't a
> > simple "map".
> > What is the best way to handle this?
> > According to the theory, anything that consumes a list and produces a
> > value is some kind of fold. [Assuming it traverses the list in a
> > sensible order!] So it looks like you could implement this as a fold.
> > But should that be a LEFT-fold or a RIGHT-fold? (I always get confused
> > between the two!)
> Sounds like a mapAccum, a combination of map and fold,
> If you gave a concrete example it would be easier to diagnose.
> -- Don
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe