Skip to content

Instantly share code, notes, and snippets.

@pkese
Last active February 1, 2021 10:45
Show Gist options
  • Save pkese/d4ccd55d6d22f143cf0934e61c1a44d8 to your computer and use it in GitHub Desktop.
Save pkese/d4ccd55d6d22f143cf0934e61c1a44d8 to your computer and use it in GitHub Desktop.
let (|IsMultiple|_|) n x = if x % n = 0 then Some n else None
[1..100]
|> List.map (function
| IsMultiple 15 x -> "FizzBuzz"
| IsMultiple 5 x -> "Buzz"
| IsMultiple 3 x -> "Fizz"
| x -> $"{x}")
|> List.iter (printfn "%s")
@micheleriva
Copy link

Hey, I love this solution; thank you so much for sharing! Unfortunately, I can't see your comment on YouTube anymore. Have you deleted it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment