Skip to content

Instantly share code, notes, and snippets.

@krisajenkins
Created August 12, 2012 18:57
Show Gist options
  • Save krisajenkins/3333741 to your computer and use it in GitHub Desktop.
Save krisajenkins/3333741 to your computer and use it in GitHub Desktop.
Fizzbuzz in clojure.
(clojure.pprint/pprint
(map vector
(range 25)
(cycle [:fizz :_ :_])
(cycle [:buzz :_ :_ :_ :_])))
; Credit to http://clojure-and-me.blogspot.co.uk/2012/08/functional-fizzbuzz.html, code rewritten a little by me.
@krisajenkins
Copy link
Author

Output: 
([0 :fizz :buzz]
 [1 :_ :_]
 [2 :_ :_]
 [3 :fizz :_]
 [4 :_ :_]
 [5 :_ :buzz]
 [6 :fizz :_]
 [7 :_ :_]
 [8 :_ :_]
 [9 :fizz :_]
 [10 :_ :buzz]
 [11 :_ :_]
 [12 :fizz :_]
 [13 :_ :_]
 [14 :_ :_]
 [15 :fizz :buzz]
 [16 :_ :_]
 [17 :_ :_]
 [18 :fizz :_]
 [19 :_ :_]
 [20 :_ :buzz]
 [21 :fizz :_]
 [22 :_ :_]
 [23 :_ :_]
 [24 :fizz :_])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment