Last active
June 10, 2016 11:11
-
-
Save stoeffel/5cf6275f8e47b54014e43adf92d4394c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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