Created
November 14, 2014 05:23
-
-
Save orb/80303c711ff2eb6a1a37 to your computer and use it in GitHub Desktop.
is or a conditional?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; http://gigasquidsoftware.com/blog/2014/11/13/clojure-fizzbuzz-without-conditionals | |
(defn fb [n] | |
(or (->> (map #(str %1 %2) | |
(cycle [nil nil "fizz"]) (cycle [nil nil nil nil "buzz"])) | |
(take n) | |
last | |
not-empty) | |
n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment