[Haskell-cafe] I'd like start with Haskell, but...

Dan Mead d.w.mead at gmail.com
Sun Dec 17 09:46:57 EST 2006


sum <- newIORef 0
> i <- newIORef 1
> let go = do i' <- readIORef i
>             when (i'<n) $ do
>                 modifyIORef sum (+i')
>                 modifyIORef i   (+1)
>                 go
> result <- readIORef sum




why in the world would you write a  summation function like that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20061217/5a8da5dc/attachment.htm


More information about the Haskell-Cafe mailing list