;;;
;;; return t if year is a leap year, else return nil
;;;
;;; [source: TimeAndDate.com]
;;; 1. Every year that is divisible by four is a leap year;
;;; 2. of those years, if it can be divided by 100, it is NOT
;;; a leap year, unless
;;; 3. the year is divisible by 400. Then it is a leap year.
;;; Note: Before 1752, all years divisible by 4 were leap years.
;;;
;;; @creator gdt
;;; @created 02016.11.16
;;;
(defconstant EXIT 0)
(defun isleap (y)
(if (/= (mod y 4) 0) (return-from isleap nil))
(if (< y 1752) (return-from isleap t))
(return-from isleap (not (and (= (mod y 100) 0) (/= (mod y 400))))))
(defun get-input ()
(do ((n nil))
(nil)
(format t "~&enter year (~d to exit): " EXIT)
(setf n (read))
(if (or (and (integerp n) (plusp n)) (equal n EXIT)) (return n))
(format t "~&~S is not a positive integer. Try again." n)))
(do ((year))
(nil)
(setf year (get-input))
(when (= year EXIT) (return t))
(isleap year))