我经历Real world Haskell,并且到了例子: -- file: ch04/InteractWith.hs
-- Save this in a source file, e.g. Interact.hs
import System.Environment (getArgs)
interactWith function inputFile outputFile = do
我有这个相当简单的函数来计算一个大名单的元素的平均值,使用两个蓄能器至今持有的总和,到目前为止计数: mean = go 0 0
where
go s l [] = s/fromIntegral l
go s l (x:xs) = go (s+x) (l+1) xs
main = do
putStrLn (show (mean [0..100000