
16 May
2007
16 May
'07
11:48 a.m.
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.