Wow nice! :-) Of course wait-till can be done with Timers build-in JDK.
And here is a proposition for cron parsing function: (defn parse-cron-expr[ pattern ] (let[ cal (Calendar/getInstance) ] (let [[min-pat hour-pat day-pat month-pat week-pat] (letfn[ (parse-cron[ val pos cal ] (letfn[ (range-values[ val ] (if-let[ [ gr min max ] (first (re-seq #"([\d]+)-([\d]+)" val)) ] (range (Integer. min) (inc (Integer. max))) (if (= val "*") (condp = pos Calendar/DAY_OF_WEEK nil Calendar/DAY_OF_MONTH nil (map (if (= pos Calendar/MONTH) inc identity) (range (.getMinimum cal pos) (inc (.getMaximum cal pos))))) [(Integer. val)]) )) ] (let[ [ tx re div ] (first (re-seq #"([^\/]+)/?([\d]+)?" val)) div-n (or (nil? div) (Integer. div)) ] (filter #(or (nil? div) (= (mod %1 div-n) 0)) (sort (distinct (mapcat range-values (re-seq #"[^\,]+" re)))))))) (into-set[ cal val ] (into #{} val)) (into-weeks[ cal val ] (let [ z (zipmap (range 1 8) (iterate #(inc (mod %1 7)) (.getFirstDayOfWeek cal))) ] (into-set cal (map #(get z %1) val)))) (into-months[ cal val ] (into-set cal (map dec val))) ] (let[ cal (repeat cal) ] (map #(%1 %2 %3) [into-set into-set into-set into-months into-weeks] cal (map parse-cron (re-seq #"[\S]+" pattern) [ Calendar/MINUTE Calendar/HOUR_OF_DAY Calendar/DAY_OF_MONTH Calendar/MONTH Calendar/DAY_OF_WEEK ] cal) ))) ] (if (and (empty? day-pat) (empty? week-pat)) [min-pat hour-pat day-pat month-pat (into #{} (range (.getMinimum cal Calendar/DAY_OF_WEEK) (inc (.getMaximum cal Calendar/DAY_OF_WEEK)))) ] [min-pat hour-pat day-pat month-pat week-pat])))) and use is (parse-cron-expr "0 10 10-13 * 1-5") -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en