Re: [Haskell-cafe] Simple list processing

2008-06-12 Thread Henning Thielemann
On Wed, 11 Jun 2008, Thomas M. DuBuisson wrote: Why is there no mapAccumL' (strict)? Just a library deficiency that we can remedy or am I missing something? The strictness in foldl' is needed to avoid that unevaluated computations accumulate until the end of the list. In mapAccumL and

[Haskell-cafe] Simple list processing

2008-06-11 Thread Andrew Coppin
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

Re: [Haskell-cafe] Simple list processing

2008-06-11 Thread Don Stewart
andrewcoppin: 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

Re: [Haskell-cafe] Simple list processing

2008-06-11 Thread Daniel Fischer
Am Mittwoch, 11. Juni 2008 20:17 schrieb Andrew Coppin: So it looks like this can be implemented as a fold or an unfold. But neither way looks especially easy. Both of these patterns seem to be more general than necessary; I only want to take 1 element of input and produce 1 element of

Re: [Haskell-cafe] Simple list processing

2008-06-11 Thread Chris Eidhof
Hey Andrew, On 11 jun 2008, at 20:17, Andrew Coppin wrote: 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

Re: [Haskell-cafe] Simple list processing

2008-06-11 Thread Thomas M. DuBuisson
Why is there no mapAccumL' (strict)? Just a library deficiency that we can remedy or am I missing something? Don Stewart wrote: andrewcoppin: 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