Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created December 17, 2016 15:49
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 deque-blog/fdd8bed91346ee554d26884e223f2dd8 to your computer and use it in GitHub Desktop.
Save deque-blog/fdd8bed91346ee554d26884e223f2dd8 to your computer and use it in GitHub Desktop.
fizzBuzz :: [(Int, String)] -> Int -> String
fizzBuzz rules i =
let r = concatMap (\(n,s) -> if mod i n == 0 then s else "") rules
in if r == "" then show i else r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment