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.159 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.158 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.157 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.156 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.155 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.154 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.153 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.152 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.151 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.150 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.149 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.148 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.147 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.146 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.145 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.144 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.143 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.142 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.141 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.2.1.140 tracks/clojure/exercises/kindergarten-garden/src/example.clj