Re: [Haskell-cafe] Help understanding sharing

2008-04-15 Thread Ryan Ingram
To add to this; sharing is not always what you want; sometimes it's a time/space trade-off and sometimes it's actually strictly worse than not sharing. For example: f :: Integer - [Integer] f x = take 1000 [x..] sum :: [Integer] - Integer sum = foldl' (+) 0 expensiveZero :: Integer

[Haskell-cafe] Help understanding sharing

2008-04-14 Thread Patrick Surry
I'm new to Haskell and trying to get a better understanding of sharing (and ultimately memoization). I've read SOE and various of the tutorials, as well as browsing around the wiki and old mailing lists. Most of the examples of memoization seem to revolve around Fibonacci, and are based

Re: [Haskell-cafe] Help understanding sharing

2008-04-14 Thread Albert Y. C. Lai
Patrick Surry wrote: I've seen other discussions that suggest that lists are always shared while in scope (so the fibs trick works). But is that just a feature of the standard compilers, or is it somewhere mandated in the Hakell spec (I don't see anything obvious in the Haskell Report tho