Sha256: cfb2b7fe9483696dfd02901998a588b1fc7c004713221c231d6e475321848f55

Contents?: true

Size: 597 Bytes

Versions: 300

Compression:

Stored size: 597 Bytes

Contents

(ns clock)

(defn clock
  "Return a 24 hour clock representation of the given hours and minutes."
  [in-hour in-minute]
  (let [total-minutes (mod (+ (* in-hour 60) in-minute) (* 60 24))
        hours (mod (quot total-minutes 60) 24)
        minutes (mod total-minutes 60)]
    {:hour hours :minute minutes}))

(defn clock->string
  "Print the HH:MM representation of a clock."
  [in-clock]
  (format "%02d:%02d" (:hour in-clock) (:minute in-clock)))

(defn add-time
  "Add minutes to the given clock."
  [in-clock minutes-to-add]
  (clock (:hour in-clock) (+ (:minute in-clock) minutes-to-add)))

Version data entries

300 entries across 300 versions & 1 rubygems

Version Path
trackler-2.0.8.15 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.14 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.13 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.12 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.11 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.10 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.9 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.8 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.7 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.6 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.5 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.4 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.3 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.2 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.8.1 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.7.0 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.6.44 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.6.43 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.6.42 tracks/clojure/exercises/clock/src/example.clj
trackler-2.0.6.41 tracks/clojure/exercises/clock/src/example.clj