[Haskell-cafe] Slow IO or bad code?
Chaddaï Fouché
chaddai.fouche at gmail.com
Thu Aug 9 12:35:22 EDT 2007
Note that this code isn't more successful, clearly I have
misunderstood one requirement :
import qualified Data.ByteString.Char8 as B
import Data.List (unfoldr)
main = B.interact $ hot
hot = B.unlines . map (B.pack . show) . processList . tail . unfoldr readInt1
readInt1 cs = do
(n, cs') <- B.readInt cs
return (n, B.tail cs')
processList [] = []
processList (x:xs) = (sum $ zipWith (*) men women) : processList rest
where (men,r1) = splitAt x xs
(women,rest) = splitAt x r1
--
Jedaï
More information about the Haskell-Cafe
mailing list