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