Skip to content

Instantly share code, notes, and snippets.

@silasolla
Last active September 21, 2023 19:39
Show Gist options
  • Select an option

  • Save silasolla/ac26c33b69c8e29f75fd2081fdb06d6d to your computer and use it in GitHub Desktop.

Select an option

Save silasolla/ac26c33b69c8e29f75fd2081fdb06d6d to your computer and use it in GitHub Desktop.
FizzBuzz implementation written in Standard ML
fun fizzBuzz n =
let
fun fizzBuzz' n' =
case (n' mod 3, n' mod 5) of
(0, 0) => "FizzBuzz"
| (0, _) => "Fizz"
| (_, 0) => "Buzz"
| _ => Int.toString n'
fun proc n' =
let
val _ = (print o fizzBuzz') n'
val _ = print "\n"
in
()
end
val range = List.tabulate (n, fn n' => n' + 1)
in
List.app proc range
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment