Skip to content

Instantly share code, notes, and snippets.

@adacola
Last active April 16, 2021 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adacola/4860adc60472f84ef91fa5074cd2726d to your computer and use it in GitHub Desktop.
Save adacola/4860adc60472f84ef91fa5074cd2726d to your computer and use it in GitHub Desktop.
type FizzBuzz = Fizz | Buzz
let fizzbuzz<'a100>() =
let fizz = nameof Fizz
let buzz = nameof Buzz
let fizzbuzz = nameof FizzBuzz
let three = (nameof int).Length
let five = (nameof float).Length
let one = (nameof System.Math.E).Length
let hundred = nameof<'a100>.ToCharArray() |> Array.tail |> System.String |> int
let zero = List.empty.Length
for i = one to hundred do
if i % five = zero && i % three = zero then stdout.WriteLine fizzbuzz
elif i % three = zero then stdout.WriteLine fizz
elif i % five = zero then stdout.WriteLine buzz
else i |> string |> stdout.WriteLine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment