earliest, latest #107

Closed
coltnz opened this Issue Feb 17, 2014 · 2 comments

Projects

None yet

2 participants

@coltnz
coltnz commented Feb 17, 2014

I use these a lot, seem useful additions?

(defn earliest [& dts]
  (reduce (fn [dt1 dt2]
            (if (pos? (compare dt1 dt2))
              dt2
              dt1))
          dts))

(defn latest [& dts]
  (reduce (fn [dt1 dt2]
            (if (neg? (compare dt1 dt2))
              dt2
              dt1))
          dts))
Owner

@coltnz looks good. Please submit a pull request with tests!

Owner

Fixed in #108.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment