(Haskell) FizzBuzz

The dread FizzBuzz question — really, a test if your average programmer knows his or her FOR loops. The spec is that you’re counting from 1 to 100. Your program should print out “fizz” if the index is divisible by three, and “buzz” if it’s divisible by five, and “fizzbuzz” if it’s divisible by both.

I have a couple different versions in this code: first, a few functions just fizzing or buzzing. Second, a generalization viagra for men in india price. which allows any standard message against any divisor. Third, a purely functional version that zips two lists together (giving us free concatenation for “fizzbuzz”). Fourth, a list comprehension and lastly, a monadic version that calls a pure function that uses guards.

  • Posted by on January 1st, 1970

This entry was posted in Haskell and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Why ask?