Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -1,8 +1,13 @@
open console imperative
open monad io
loop n | n > 10 = ()
| else = rec write (show n) f `seq` loop (n+1)
where f | n % 5 == 0 = "\r\n"
| else = ", "
loop n =
if n > 10 then do
return ()
else do
putStr (show n)
putStr f
loop (n + 1)
where f | n % 5 == 0 = "\r\n"
| else = ", "
loop 1
_ = loop 1 ::: IO

View file

@ -1,8 +1,11 @@
open console imperative
open monad io
loop [] = ()
loop (x::xs) = rec (write << show) x c `seq` loop xs
where c | x % 5 == 0 = "\r\n"
| else = ", "
loop [] = return ()
loop (x::xs) = do
putStr (show x)
putStr f
loop xs
where f | x % 5 == 0 = "\r\n"
| else = ", "
loop [1..10]
_ = loop [1..10] ::: IO