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

Version Path
trackler-2.1.0.36 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.34 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.33 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.32 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.31 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.30 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.29 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.28 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.27 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.26 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.25 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.24 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.23 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.22 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.21 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.20 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.19 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.18 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.17 tracks/clojure/exercises/kindergarten-garden/src/example.clj
trackler-2.1.0.16 tracks/clojure/exercises/kindergarten-garden/src/example.clj