[Haskell-cafe] loop problem

Roelof Wobben r.wobben at home.nl
Sat May 10 16:31:36 UTC 2014


Stuart A. Kurtz schreef op 10-5-2014 18:17:
> Dear Roelof,
>
> I took a quick look at the course -- it wasn't immediately evident to me where you are in it. It looks pretty good, although more examples/exercise are always welcome.
>
> It occurred to me, though, if you're going to write it so it looks like C, you'd might as well take advantage of Text.Printf:
>
>      import Control.Monad
>      import Text.Printf
>
>      loop :: Int -> IO ()
>      loop n = when (n <= 100) $ do
> 	printf "%d %d\n" n (n^2)
> 	loop $ n+1
>
>      main :: IO ()
>      main = loop 1
>
> Peace,
>
> Stu
>
>

Sorry that I did not make that clear.
So in your oponion this could be a good way to learn haskell very good.

I get the feeling on your remarks that im not really to do things the 
haskell way and that is what im looking for.
I have looked at the book http://learnyouahaskell.com/chapters but I  
miss there exercises

What do you think about this one : 
http://www.umiacs.umd.edu/~hal/docs/daume02yaht.pdf

Roelof


More information about the Haskell-Cafe mailing list