(def ^{:private true} buckets
  {"day" [.getYear .getMonthOfYear .getDayOfMonth]
   "week" [.getYear .getWeekOfWeekyear]
   "month" [.getYear .getMonthOfYear]})

(defn days [granularity]
  (fn [event]
    (let [dt (get-time event)
          bucket (buckets granularity)]
      (apply juxt (map memfn bucket)))))

Generated by Phil Hagelberg using scpaste at Mon Oct 31 17:56:49 2011. PDT. (original)