Skip to content

Instantly share code, notes, and snippets.

@attentive
Created October 24, 2018 12:08
Show Gist options
  • Save attentive/80be7fd8f9b29cc98fe69e00650e2d43 to your computer and use it in GitHub Desktop.
Save attentive/80be7fd8f9b29cc98fe69e00650e2d43 to your computer and use it in GitHub Desktop.
(ns fizzbuzz
(:require [clojure.core.match :refer [match]]))
(defn interpret [x y i]
(match [x y i]
[true true _] "FizzBuzz"
[true false _] "Fizz"
[false true _] "Buzz"
:else i))
(defn main []
(->> (map interpret
(cycle [false false true])
(cycle [false false false false true])
(iterate inc 1))
(take 100)
(apply println)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment