Hello Isaac, Saturday, November 11, 2006, 5:56:57 AM, you wrote:
> 2) Some Haskell programs were pushed into 'interesting alternative > implementations' because they'd strayed so far from the spirit of the > benchmark. (It takes a while for people to notice and complain, but > eventually they do.) it's very real :) while ghc allows to write rather fast programs, such programs are much harder to write and manage than even equivalent C ones! just for comparison: -- compact, but very slow s = sum arr // not so compact, but very fast double sum=0; for(int i=0; i<10; i++) sum+=arr[i]; // nor fast, nor compact, nor in Haskell spirit anyway :)) sum' <- newIORef 0 for 0 10 $ \i -> do x <- unsafeRead arr i sum <- readIORef sum' writeIORef sum' (sum+x) for :: Int -> Int -> (Int -> IO a) -> IO () -- Faster equivalent of "mapM_ action [from..to-1]" for from to action = go from where go i | i>=to = return () | otherwise = do action i go $! (i+1) -- Best regards, Bulat mailto:[EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe