Created
December 15, 2010 20:24
-
-
Save sbastn/742557 to your computer and use it in GitHub Desktop.
Simple fizzbuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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