Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.