Sha256: f69ea1a67a1bcbf9e34c4942b75d98d20ec0ad01f73e3aeed4400e59db9afa24
Contents?: true
Size: 784 Bytes
Versions: 205
Compression:
Stored size: 784 Bytes
Contents
(ns kindergarten-garden) (def default-students ["Alice" "Bob" "Charlie" "David" "Eve" "Fred" "Ginny" "Harriet" "Ileana" "Joseph" "Kincaid" "Larry"]) (def seeds {\G :grass \C :clover \R :radishes \V :violets}) (defn row-to-seeds [row-string] (map seeds row-string)) (defn garden-to-rows [garden] (clojure.string/split-lines garden)) (defn garden ([string] (garden string default-students)) ([string students] (let [students (map #(keyword (clojure.string/lower-case %1)) (sort students)) [front back] (map #(partition 2 %1) (map row-to-seeds (garden-to-rows string)))] (->> (interleave front back) (partition 2) (map flatten) (map vec) (zipmap students)))))
Version data entries
205 entries across 205 versions & 1 rubygems