Skip to content

Instantly share code, notes, and snippets.

@smies
Created April 23, 2013 09:20
Show Gist options
  • Save smies/5442093 to your computer and use it in GitHub Desktop.
Save smies/5442093 to your computer and use it in GitHub Desktop.
let (|Fizz|_|) n = if n % 3 = 0 then Some("Fizz") else None
let (|Buzz|_|) n = if n % 5 = 0 then Some("Buzz") else None
let FizzBuzz n =
match n with
| Fizz f & Buzz b -> f + b
| Fizz f -> f
| Buzz b -> b
| _ -> string n
[ for i in 1 .. 15 do FizzBuzz i ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment