Last active
November 15, 2015 20:49
-
-
Save stoft/44c5ebd1ed89914127fa to your computer and use it in GitHub Desktop.
FizzBuzz in Elm
This file contains hidden or 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 Graphics.Element exposing (show) | |
main = show (iterate 100) | |
fizzbuzz : Int -> String | |
fizzbuzz n = | |
if | mod n 15 -> "FizzBuzz" | |
| mod n 5 -> "Buzz" | |
| mod n 3 -> "Fizz" | |
| otherwise -> toString n | |
mod : Int -> Int -> Bool | |
mod i j = | |
i % j == 0 | |
iterate : Int -> List String | |
iterate max = | |
List.map fizzbuzz [1 .. max] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment