~willvaughn/kata

a33b6ccb8e1fee0fc35ca21db4a084d52c386c38 — William Vaughn 1 year, 5 months ago 7dc3ec4
exercism cars-assemble solution
1 files changed, 11 insertions(+), 2 deletions(-)

M exercism/clojure/cars-assemble/src/cars_assemble.clj
M exercism/clojure/cars-assemble/src/cars_assemble.clj => exercism/clojure/cars-assemble/src/cars_assemble.clj +11 -2
@@ 4,9 4,18 @@
  "Returns the assembly line's production rate per hour,
   taking into account its success rate"
  [speed]
  )
  (let [base-throughput 221.0
        rate-factor (cond (zero? speed) 0.0
                          (and (> speed 0) (<= speed 4)) 1.0
                          (and (> speed 4) (<= speed 8)) 0.9
                          (= speed 9) 0.8
                          :else 0.77)]
    (* speed base-throughput rate-factor)))

(defn working-items
  "Calculates how many working cars are produced per minute"
  [speed]
  )
  (-> speed
      production-rate
      int
      (#(quot % 60))))