At 10:55 28/09/04 +0100, Malcolm Wallace wrote:
Keith Wansbrough <[EMAIL PROTECTED]> writes:

>           I can't believe that a simple "wc" implementation should be
> 570 times slower in Haskell than OCaml - could someone investigate and
> fix the test?

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. 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?

#g


------------ Graham Klyne For email: http://www.ninebynine.org/#Contact

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to