Skip to content

Instantly share code, notes, and snippets.

@thomas-shares
Created August 6, 2012 19:29
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 thomas-shares/3277803 to your computer and use it in GitHub Desktop.
Save thomas-shares/3277803 to your computer and use it in GitHub Desktop.
FizzBuzz, but functional
(def three (cycle [nil nil "fizz"]))
(def five (cycle [nil nil nil nil "buzz"]))
(map vector (range 1 16) three five )
;([1 nil nil] [2 nil nil] [3 "fizz" nil] [4 nil nil] [5 nil "buzz"] [6 "fizz" nil] [7 nil nil] [8 nil nil] [9 "fizz" nil] [10 nil "buzz"] [11 nil nil] [12 "fizz" nil] [13 nil nil] [14 nil nil] [15 "fizz" "buzz"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment