Created
January 12, 2016 11:38
-
-
Save miklund/9d8e62dd70be793b311e to your computer and use it in GitHub Desktop.
2013-01-31 FizzBuzz
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
# Title: FizzBuzz | |
# Author: Mikael Lundin | |
# Link: http://blog.mikaellundin.name/2013/01/31/fizzbuzz.html |
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
// System.String.Join(" ", fizzbuzz 1 |> Seq.take 100) | |
let rec fizzbuzz x = seq { | |
yield | |
match x % 3, x % 5 with | |
| 0, 0 -> "fizz buzz" | |
| 0, _ -> "fizz" | |
| _, 0 -> "buzz" | |
| _, _ -> x.ToString() | |
yield! fizzbuzz (x + 1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment