Demo entry 6597748

Fizzbuzz

   

Submitted by KevLaKev on Jun 04, 2017 at 22:08
Language: Haskell. Code size: 343 Bytes.

module SimpleFizzBuzz where

loop n x = cycle $ replicate (n-1) "" ++ [x]

fizzes = loop 3 "fizz"

buzzes = loop 5 "buzz"

pattern = zipWith (++) fizzes buzzes

fizzbuzz = zipWith combine pattern [1..] where
	combine word number = if null word
		then show number
		else  word

main _ = do
	println $ take 39 $ drop 103 fizzbuzz

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).