Skip to content

Instantly share code, notes, and snippets.

@mnzk
Last active January 2, 2016 07:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnzk/8268456 to your computer and use it in GitHub Desktop.
Save mnzk/8268456 to your computer and use it in GitHub Desktop.
;; hy-lang fizzbuzz
(import [itertools [count imap]])
(import [pprint [pprint]])
(defn freq [v n]
(->> (* [""] (dec n)) (+ [v])))
(defn fizzbuzz []
(->> (imap (fn [f b n] (or (+ f b) n))
(cycle (freq "fizz" 3))
(cycle (freq "buzz" 5))
(count))
(drop 1)))
(pprint (->> (fizzbuzz) (take 100) list))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment