Friday, February 29, 2008

Is it a leap year

Here's a bit of elisp code to find out...


(defun is-century-year(year)
(if (= (mod year 100) 0)
t
nil))

(defun is-leap-year(year)
"leap year is century years divisible by 400,
not other century years, otherwise anything evenly
divisble by 4"
(if (is-century-year year)
(if (= 0 (mod year 400))
t
nil)
(if (= 0 (mod year 4))
t
nil)))

1 comment:

Dieta said...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Dieta, I hope you enjoy. The address is http://dieta-brasil.blogspot.com. A hug.