[Haskell-cafe] Lazy vs correct IO [Was: A round of golf]
jason.dusek at gmail.com
Sun Apr 5 10:22:44 EDT 2009
2008/09/18 <oleg at okmij.org>:
> Operationally, the code does not open more than one file at a
> time. More importantly, the code *never* reads more than 4096
> characters at a time. A block of the file is read, split into
> words, counted, and only then another chunk is read. After one
> file is done, it is closed, and another file is processed. One
> can see that only one file is being opened at a time by
> enabling traces. The processing is fully incremental.
It opens and closes each file in turn; but it would it be
unwise to open and close each file as we'd read a chunk from
it? This would allow arbitrary interleaving.
More information about the Haskell-Cafe