Sha256: 91576eee261ac9810be36aa2d884ba102709bbd68ce81535b1eacba3b2bfa003
Contents?: true
Size: 784 Bytes
Versions: 191
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 (.toLowerCase %1)) (sort students)) [front back] (map #(partition 2 %1) (map row-to-seeds (garden-to-rows string)))] (zipmap students (map vec (map flatten (partition 2 (interleave front back))))))))
Version data entries
191 entries across 191 versions & 1 rubygems