deeqSeq proposal
Andy Gill
andy at galois.com
Thu Apr 6 03:06:53 EDT 2006
On Apr 5, 2006, at 4:51 PM, John Meacham wrote:
> On Wed, Apr 05, 2006 at 10:34:09AM -0500, Spencer Janssen wrote:
>> How about an implementation that sets the deepSeq'd bit *after* each
>> field has been successfully deepSeq'd? deepSeq'ing a cyclic
>> structure
>> would behave just like an infinite structure.
>
> what would be the point of having a bit then?
Because deepSeq's cost to evaluate a list that will eventually be
required is linear.
The maximum number of deepSeq calls (and recursive calls) you can do
over any
structure is simply the number of nodes.
Consider:
foldr (\ a as -> deepSeq (a : as)) [] $ some list
With the bit ==> one deepSeq per cons, then we hit the 'is-pre-
deepSeqd' bit.
Without the bit ==> O(n^2)
> in any case, we should talk about the meaning of deepseqing something,
> not its implementation.
>
> depth limited recursive seq seems like the best route to me.
>
> John
>
> --
> John Meacham - ⑆repetae.net⑆john⑈
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://haskell.org/mailman/listinfo/haskell-prime
More information about the Haskell-prime
mailing list