Skip to content

Instantly share code, notes, and snippets.

@fotonmoton
Created November 24, 2019 15:52
Show Gist options
  • Save fotonmoton/f598b0d36e59a7c7bf27438d4f37f21f to your computer and use it in GitHub Desktop.
Save fotonmoton/f598b0d36e59a7c7bf27438d4f37f21f to your computer and use it in GitHub Desktop.
Raindrops
module Raindrops
let convert number =
let getSound (divider, sound) =
if (number % divider = 0)
then sound
else ""
let getSoundString drops =
drops
|> List.map getSound
|> List.fold (+) ""
let sound = getSoundString [(3, "Pling"); (5, "Plang"); (7, "Plong")]
if (sound = "")
then sprintf "%d" number
else sound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment