
15 Feb
2011
15 Feb
'11
5:29 p.m.
On 15/02/2011 08:35 PM, Daniel Fischer wrote:
The result is that the list
[1 .. 10*1024*1024*k]
from the penultimate line of random_file is shared between the four iterations of the inner loop in file_batch (for k = 1 .. 4). Oops.
Ouch! That's gotta sting in the morning... o_O I suppose what we could really do with is a combinator that runs a monadic action N times, without actually constructing a list N elements long in order to do so. Then it becomes blatently obvious that there's nothing to share, and the problem goes away. They say that in Haskell, "a list *is* a loop". Apparently, not always. ;-)