Created
March 22, 2010 23:29
-
-
Save making/340669 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(declare fizz) | |
(declare buzz) | |
(defn fizz-buzz-1 [n] | |
(when (> n 0) | |
(print n " = ") | |
#(fizz n))) | |
(defn fizz [n] | |
(if (zero? (rem n 3)) | |
(print 'fizz)) | |
#(buzz n)) | |
(defn buzz [n] | |
(if (zero? (rem n 5)) | |
(print 'buzz)) | |
(println) | |
#(fizz-buzz-1 (dec n))) | |
(def fizz-buzz (partial trampoline fizz-buzz-1)) | |
;; (fizz-buzz 10000) ; StackOverflowしないぜ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment