Skip to content

Instantly share code, notes, and snippets.

@sbastn
Created December 15, 2010 20:24
Show Gist options
  • Save sbastn/742557 to your computer and use it in GitHub Desktop.
Save sbastn/742557 to your computer and use it in GitHub Desktop.
Simple fizzbuzz
(ns hello-world.core
(:require [clojure.string :as str]))
(def substitute (sorted-map 3 "Fizz" 5 "Buzz"))
(defn play [n]
(let [match (filter #(= 0 (mod n %)) (keys substitute))]
(if (empty? match)
n
(str/join "" (map #(substitute %) match)))))
(time (map play (range 1 100000)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment