Re: Working character by character in Haskell

2001-10-19 Thread Malcolm Wallace
"Simon Marlow" <[EMAIL PROTECTED]> writes: > > Well, in Haskell each character of the string takes 20 bytes: 12 bytes > > for the list cell, and 8 bytes for the character itself Ahem, _Haskell_ mandates no such thing. Perhaps you are talking about a specific implementation? ghc probably. > I

Re: Working character by character in Haskell

2001-10-18 Thread Andre W B Furtado
(I think so...) why is the C program so much faster than it? Thanks again, -- Andre - Original Message - From: Albert Lai <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 18, 2001 9:42 PM Subject: Re: Working character by character in Haskell

Working character by character in Haskell

2001-10-18 Thread Tom Pledger
Andre W B Furtado writes: : | copyFile :: String -> String -> IO String | copyFile [] s = return (reverse s) | copyFile (a:as) s = copyFile as ( (doSomeStuffWith a):s) : | For example, suppose function doSomeStuffWith returns its own | parameter. Using a 1.5MB file in this case, the Haskel

Working character by character in Haskell

2001-10-18 Thread Andre W B Furtado
I'm trying to create a fast program in Haskell that reads the content of a file, do some stuff with its characters (one by one) an then save the final result (the modified characters) in another file. The fastest program I've developed so far is: main :: IO () main = do bmFile <- openFileEx "in.