you already know how to write "*" one ... so you just have to know how

to do it the neded amount :

two ways : 1/ you repeat the function

2/ you reapet the data one which the function is applied.

this is like 2/

2006/6/16, J. Garrett Morris <

[hidden email]>:

> main n = putStrLn (replicate n '*')

>

> main n = putStrLn (take n (repeat '*'))

this is like 1/

> main n = sequence (take n (repeat (putStr "*")))

in order to remove the interleaved '\n', just apply the trick (n-1)

times then one more for '\n'.

> (but that doesn't have a final new line. The more complicated:

>

> main n = sequence (take (n - 1) (repeat (putStr "*"))) >> putStrLn "*"

>

> should solve that problem.)

>

mt

_______________________________________________

Haskell-Cafe mailing list

[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe