Skip to content

Instantly share code, notes, and snippets.

@alandipert
Last active December 20, 2017 03:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alandipert/1156115 to your computer and use it in GitHub Desktop.
Save alandipert/1156115 to your computer and use it in GitHub Desktop.
FizzBuzz, the fib of pattern matching
;; FizzBuzz, the fib of pattern matching
;; with https://github.com/clojure/core.match
(require '[clojure.core.match :refer [match]])
(doseq [n (range 1 101)]
(println (match [(mod n 3) (mod n 5)]
[0 0] "FizzBuzz"
[0 _] "Fizz"
[_ 0] "Buzz"
:else n)))
@billgathen
Copy link

Love it!

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