Skip to content

Instantly share code, notes, and snippets.

@alandipert

alandipert/fb.clj

Last active Dec 20, 2017
Embed
What would you like to do?
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)))
@candera

This comment has been minimized.

Copy link

@candera candera commented Aug 25, 2011

That f'ing rocks. :)

@ericnormand

This comment has been minimized.

Copy link

@ericnormand ericnormand commented Feb 7, 2014

Nice!

@billgathen

This comment has been minimized.

Copy link

@billgathen billgathen commented Feb 7, 2014

Love it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.