Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@omasanori
Created September 28, 2011 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omasanori/1249422 to your computer and use it in GitHub Desktop.
Save omasanori/1249422 to your computer and use it in GitHub Desktop.
A hobby implementation to calculate leap years.
(defn leap-year?
"Returns true if x is leap year, false otherwise."
[x]
(or (zero? (rem x 400))
(and (zero? (rem x 4))
(not (zero? (rem x 100))))))
(defn leap-years
"Returns a lazy seq of leap years."
[]
(filter leap-year? (drop 1582 (range))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment