How to write a lazy variant ?

Dmitry Astapov [email protected]
05 Dec 2001 10:16:34 +0200


>> I hate to followup to myself, but looks like I had to. I really was
>> too tired and lazy version could be obtained by simple use of
>> accumulator:
 ADR> Are you _sure_ that's all it takes?

Well, I cannot be 100% sure, but what I observe in ghci is that evaluating
'recs <- readRecordFile "some_name"' with first variant of routines takes
about two minutes to complete (file is quite large) and gobbles up
substatial amount of memory, while second variant returns almost
immediately, and consumes memory only when I start to process recs.


-- 
Dmitry Astapov //ADEpt                               E-mail: [email protected]
GPG KeyID/fprint: F5D7639D/CA36 E6C4 815D 434D 0498  2B08 7867 4860 F5D7 639D