YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
|
|
@ -1,6 +1,18 @@
|
|||
main = putStr $ concat $ map fizzbuzz [1..100]
|
||||
|
||||
fizzbuzz :: Int -> String
|
||||
fizzbuzz n =
|
||||
"\n" ++ if null (fizz++buzz) then show n else fizz++buzz
|
||||
where fizz = if mod n 3 == 0 then "Fizz" else ""
|
||||
buzz = if mod n 5 == 0 then "Buzz" else ""
|
||||
'\n' :
|
||||
if null (fizz ++ buzz)
|
||||
then show n
|
||||
else fizz ++ buzz
|
||||
where
|
||||
fizz =
|
||||
if mod n 3 == 0
|
||||
then "Fizz"
|
||||
else ""
|
||||
buzz =
|
||||
if mod n 5 == 0
|
||||
then "Buzz"
|
||||
else ""
|
||||
|
||||
main :: IO ()
|
||||
main = putStr $ concatMap fizzbuzz [1 .. 100]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue