Skip to content

Instantly share code, notes, and snippets.

@making
Created March 22, 2010 23:29
Show Gist options
  • Save making/340669 to your computer and use it in GitHub Desktop.
Save making/340669 to your computer and use it in GitHub Desktop.
(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