Last active
August 29, 2015 14:16
-
-
Save doorhammer/5e543f12d78f6423a318 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
type FizzBuzz = | |
| Fizzy of int | |
| Buzzy of int | |
| FizzBuzzy of int | |
| NormalNumber of int | |
let fizzBuzz x = | |
match x with | |
| x when (x % 15) = 0 -> FizzBuzzy(x) | |
| x when (x % 5) = 0 -> Buzzy(x) | |
| x when (x % 3) = 0 -> Fizzy(x) | |
| _ -> NormalNumber x | |
let showFizzBuzz x = | |
match x with | |
| Fizzy x -> "Fizz" | |
| Buzzy x -> "Buzz" | |
| FizzBuzzy x -> "FizzBuzz" | |
| NormalNumber x -> string x | |
let typedFizzBuzz = [1 .. 100] |> List.map fizzBuzz | |
let stringFizzBuzz = typedFizzBuzz |> List.map showFizzBuzz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment