Skip to content

Instantly share code, notes, and snippets.

@bsiegel
Created January 29, 2014 17:09
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 bsiegel/8692383 to your computer and use it in GitHub Desktop.
Save bsiegel/8692383 to your computer and use it in GitHub Desktop.
(ns fizzbuzz.core)
(declare fb)
(defn -main []
(doseq [i (range 1 101)]
(println (fb i))))
(defmulti fb (fn [i] [(= 0 (mod i 3)) (= 0 (mod i 5))]))
(defmethod fb [true true] [_] "FizzBuzz")
(defmethod fb [true false] [_] "Fizz")
(defmethod fb [false true] [_] "Buzz")
(defmethod fb :default [i] i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment