Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active August 29, 2015 14:10
Show Gist options
  • Save trikitrok/d88f430816823b1375cf to your computer and use it in GitHub Desktop.
Save trikitrok/d88f430816823b1375cf to your computer and use it in GitHub Desktop.
(def naturals (drop 1 (range)))
(def fizz-buzz-seq
(map #(clojure.string/replace (str %1 %2) #"^$" (str %3))
(cycle '("" "" "Fizz"))
(cycle '("" "" "" "" "Buzz"))
naturals))
(defn fizz-buzz [n]
(clojure.string/join " " (take n fizz-buzz-seq)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment