On Wed, 16 May 2007, Sergey Perminov wrote:

> How to solve task of reversing big list with constant heap space used?

By avoiding 'reverse'?

> Amount of heap space used grows exponentially in following examples:
>
> 1:
> main = putStrLn.show.head $reverse [1..10000000]

Data.List.last



I think that in every particular case you have to find out how to avoid
'reverse'. Especially if you have two 'reverse's like in
   reverse . dropWhile p . reverse
 there are more efficient solutions.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to