Home
Insert
Update snippet 'Active Pattern FizzBuzz'
Title
Description
FizzBuzz using Active Patterns.
Source code
open System let (|Fizz|None|) x = if x % 3 = 0 then Fizz else None let (|Buzz|None|) x = if x % 5 = 0 then Buzz else None let fizzbuzz x = match x with | Fizz & Buzz -> "FizzBuzz" | Fizz -> "Fizz" | Buzz -> "Buzz" | _ -> x.ToString() let start xs = for i in xs do printfn "%s" (fizzbuzz i)
Tags
fizzbuzz
fizzbuzz
Author
Link
Reference NuGet packages
If your snippet has external dependencies, enter the names of NuGet packages to reference, separated by a comma (
#r
directives are not required).
Update