Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue