Skip to content

Instantly share code, notes, and snippets.

@stoeffel
Last active June 10, 2016 11:11
Show Gist options
  • Save stoeffel/5cf6275f8e47b54014e43adf92d4394c to your computer and use it in GitHub Desktop.
Save stoeffel/5cf6275f8e47b54014e43adf92d4394c to your computer and use it in GitHub Desktop.
import Html exposing (text)
import String
fizzbuzz : Int -> List String
fizzbuzz to =
let
current =
case (to % 3, to % 5) of
(0, 0) -> "Fizz Buzz"
(0, _) -> "Fizz"
(_, 0) -> "Buzz"
(_, _) -> toString to
in
case to of
0 -> []
_ -> fizzbuzz (to - 1) ++ [current]
main =
text (String.join ", " (fizzbuzz 20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment