Sha256: b4eb72c5eaa9884bc1445b733b254a41ce6878b7d7f9a32d9b7e6fd95b4b4561
Contents?: true
Size: 487 Bytes
Versions: 396
Compression:
Stored size: 487 Bytes
Contents
(ns raindrops (:require [clojure.string :refer [blank?]])) (def ^:private sound-map { 3 "Pling" 5 "Plang" 7 "Plong" }) (defn- divisors [number] (filter (fn [[div sound]] (zero? (rem number div))) sound-map)) (defn- sounds-for [number] (let [divisors (divisors number) sounds (map last divisors)] (apply str sounds))) (defn convert [number] (let [sounds (sounds-for number)] (if (blank? sounds) (str number) sounds)))
Version data entries
396 entries across 396 versions & 1 rubygems