Skip to content

Instantly share code, notes, and snippets.

@IamDrowsy IamDrowsy/available.clj Secret
Created Feb 14, 2014

What would you like to do?
(require '[clj-time.predicates :as p]
'[clj-time.core :as c]
'[clj-time.periodic :as pe])
(defn days-after [date]
(rest (pe/periodic-seq date (c/days 1))))
(defn holiday? [date]
;Depends... no holidays for now
(defn after-1pm? [date]
(> (c/hour date) 13))
(defn available? [date]
(not (or (p/saturday? date) (p/sunday? date) (holiday? date))))
(defn next-available [date]
(let [available-days (filter available? (days-after date))]
((if (after-1pm? date) second first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.