Created
November 29, 2008 22:28
-
-
Save bakkdoor/30336 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun easter-date-for-year (year) | |
(let ((golden-year (+ 1 (mod year 19))) | |
(century (+ (/ year 100) 1))) | |
(let ((skipped-leap-years (- (/ (* 3 century) 4) 12)) | |
(correction-factor (- (/ (+ (* 8 century) 5) 25) 5))) | |
(let ((d (- (/ (* 5 year) 4) skipped-leap-years 10)) | |
(epac (mod (- (+ (* 11 golden-year) 20 correction-factor) skipped-leap-years) 30))) | |
(if (or (and (= epac 25) (> golden-year 11)) (= epac 24)) | |
(incf epac)) | |
(let ((n (- 44 epac)) (month nil) (day-of-month nil)) | |
(if (< n 21) | |
(setf n (+ 30 n))) | |
(setf n (- (+ n 7) (mod (+ d n) 7))) | |
(cond ((> n 31) | |
(setf month 'APRIL) | |
(setf day-of-month (- n 31))) | |
(t | |
(setf month 'MARCH) | |
(setf day-of-month n))) | |
(format nil "Easter date: ~a.~a.~a" (round day-of-month) month year)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment