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

Version Path
trackler-2.2.1.180 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.179 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.178 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.177 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.176 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.175 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.174 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.173 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.172 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.171 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.170 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.169 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.167 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.166 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.165 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.164 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.163 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.162 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.161 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.160 tracks/clojure/exercises/kindergarten-garden/src/example.clj