This is a calendar library for Clojure that uses core.logic. You can create interesting queries against the Gregorian calendar. (In the future I hope to add the ability to build queries that involve multiple calendars).
Here are some examples, and there are many more in the tests.
(use 'clojure.core.logic)
(use 'datetime-logic.gregorian)
(run* [month]
(day-of-the-week 2013 month 13 :friday))Results in (9 12).
(use 'clojure.core.logic)
(use 'datetime-logic.us-holidays)
(run* [day]
(thanksgiving-day 2013 11 day))Results in (28).
(use 'clojure.core.logic)
(use 'datetime-logic.us-holidays)
(use 'datetime-logic.gregorian)
(run* [holiday]
(fresh [month day]
(federal-holiday 2013 month day holiday)
(day-of-the-week 2013 month day :monday)))Results in (:mlk-bday :washington-bday :veterans-day :memorial-day :labor-day :columbus-day), which is only really interesting because it includes veterans day (defined as Nov 11th rather than a Monday).
These are the inspirations influencing this project.
- The Reasoned Schemer Taught me relational programming
- Calendrical Calculations Provides an algorithmic explanation of thirty calendars.
- The many lectures of David Nolen, Daniel Friedman and William Byrd.
- The Clojure/West 2013 miniKanren Confo.
Copyright © 2013-2014 Stephen Sloan
Distributed under the Eclipse Public License, the same as Clojure.