Skip to content

Instantly share code, notes, and snippets.

@dfuenzalida
Created November 15, 2014 00:20
Show Gist options
  • Save dfuenzalida/1f07bf2ab807836c767e to your computer and use it in GitHub Desktop.
Save dfuenzalida/1f07bf2ab807836c767e to your computer and use it in GitHub Desktop.
(defn fb [n]
(take n
(map (fn [a b] (get (hash-map a b) "" a))
(map str
(cycle ["" "" "Fizz"])
(cycle ["" "" "" "" "Buzz"]))
(rest (range)))))
;; Usage:
;; user=> (fb 20)
;; (1 2 "Fizz" 4 "Buzz" "Fizz" 7 8 "Fizz" "Buzz" 11 "Fizz" 13 14 "FizzBuzz" 16 17 "Fizz" 19 "Buzz")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment