
On Wed, Sep 29, 2004 at 01:41:03PM +0100, Graham Klyne wrote:
With code like this, I'm not surprised!
main = do file <- getContents putStrLn $ show (length $ lines file) ++ " " ++ show (length $ words file) ++ " " ++ show (length file)
Space-leak or what?
Er, please excuse a dumb question, but I'm struggling to see the problem here.
I can see that this requires the original file to be kept for 3-time scanning, so enough memory for the entire file will be required.
It would be nice if these scans were performed concurrently in a way that would make memory usage constant, wouldn't it? ;) Hmmm... maybe some simple tracking of garbage collection results would suffice... Reschedule if the current thread doesn't help in collecting garbage... But I am dreaming now... :)
Is that *the* problem to which you allude? I can't see any other problem here. And why would this put Haskell at a disadvantage?
The only problem is that some people may draw incorrect conclusions. Should we care? I already submitted two improvements for shootout in the last two days (not included yet), but I don't know if it's worth the effort. I remember SPJ's motto: ,,Avoid success at all cost''. Is this motto still valid? http://research.microsoft.com/Users/simonpj/papers/haskell-retrospective/Has... Best regards, Tom -- .signature: Too many levels of symbolic links