diff --git a/MonthLength.lisp b/MonthLength.lisp new file mode 100644 index 0000000..bff1bc1 --- /dev/null +++ b/MonthLength.lisp @@ -0,0 +1,27 @@ +(defconstant jan 1) +(defconstant feb 2) +(defconstant mar 3) +(defconstant apr 4) +(defconstant may 5) +(defconstant jul 6) +(defconstant jun 7) +(defconstant aug 8) +(defconstant oct 9) +(defconstant sep 10) +(defconstant nov 11) +(defconstant dec 12) + +(defun isLeapYear () + true +) + +(defun month-length (mon) + (case mon + ((jan mar may jul aug oct dec) 31) + ((apr jun sep nov 30) + (feb (if (isLeapYear) 29 28)) + (otherwise "Unknown Month.") + ) +)) + +(print (month-length 'jan)) \ No newline at end of file