Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/FizzBuzz/Haskell/fizzbuzz-5.hs
Normal file
17
Task/FizzBuzz/Haskell/fizzbuzz-5.hs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import Control.Applicative ( ZipList(ZipList, getZipList) )
|
||||
|
||||
fizzBuzz :: [String]
|
||||
fizzBuzz =
|
||||
getZipList $ go <$>
|
||||
ZipList (cycle $ replicate 2 [] <> ["fizz"]) <*>
|
||||
ZipList (cycle $ replicate 4 [] <> ["buzz"]) <*>
|
||||
ZipList (show <$> [1 ..])
|
||||
|
||||
go :: String -> String -> String -> String
|
||||
go f b n
|
||||
| null f && null b = n
|
||||
| otherwise = f <> b
|
||||
|
||||
|
||||
main :: IO ()
|
||||
main = mapM_ putStrLn $ take 100 fizzBuzz
|
||||
Loading…
Add table
Add a link
Reference in a new issue