
10 Feb
2019
10 Feb
'19
10:59 p.m.
On Sun, Feb 10, 2019 at 09:59:54PM +0100, Michele Alzetta wrote:
For hello_pure I tried this:
hello_pure :: Int -> String hello_pure n | n < 1 = "" | otherwise = "Hello World" ++ "\n" ++ hello_pure ( n - 1 )
Very good!
And it works, although ++ "\n" ++ doesn't feel so elegant.
If you want, you can rewrite is as a one-liner like this: hp2 :: Int -> String hp2 n = unlines $ replicate n "Hello world" -F