On 25 June 2010 11:19, Frank Moore <[email protected]> wrote: > Thanks for the reply. > > My main is now: > > main = do > let as = [1..2e7] :: [Double] > start <- getCurrentTime > let meanAs = mean as > let meanOver2 = meanAs `deepseq` meanAs / 2 > end <- getCurrentTime > putStrLn (show (end `diffUTCTime` start)) > start <- getCurrentTime > putStrLn (show meanOver2) > end <- getCurrentTime > putStrLn (show (end `diffUTCTime` start)) > > The time is still spent on the show meanOver2 command :(
Well, yes, because the seq'ing is still happening as part of meanOver2. The alternative is to have yet another let statement which is just "let meanAs' = meanAs `deepSeq` meanAs" and then have "meanOver2 = meanAs' / 2". -- Ivan Lazar Miljenovic [email protected] IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
