mail at joachim-breitner.de
Mon Oct 10 10:58:36 CEST 2011
Am Dienstag, den 04.10.2011, 09:39 +0300 schrieb Roman Cheplyaka:
> Suppose I want a foldl which is evaluated many times on the same
> list but with different folding functions.
I used this pattern successfully in SAT-Britney, where I generate a huge
list quite quickly, and I don’t want this list to stay in memory. I had
to pay a lot of attention to sharing, e.g. by making sure the parameters
to the function that generate the left fold are only passed when the
folding functions are also given, see in
the changes to TransRules.hs. Otherwise, I’d get a huge thunk of
closures representing the list, as Jan-Willem predicted.
Note that I want to achieve something differently than you, unless I am
mistaken: In my case, I want to make sure the list can be fused or at
least immediately garbage-collected with every use, even if the code
that calculates the list has to be run multiple times.
Joachim "nomeata" Breitner
mail at joachim-breitner.de | nomeata at debian.org | GPG: 0x4743206C
xmpp: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: This is a digitally signed message part
More information about the Glasgow-haskell-users