Skip to content

Instantly share code, notes, and snippets.

@rockBreaker
Last active August 29, 2015 14:03
Show Gist options
  • Save rockBreaker/9be800b5b6ea3581ca3b to your computer and use it in GitHub Desktop.
Save rockBreaker/9be800b5b6ea3581ca3b to your computer and use it in GitHub Desktop.
(defn leap-year?
[year]
(and (divides? 4 year)
(divides? 100 year)
(divides? 400 year)))
(defn divides?
[divisor n]
(if (= (mod n divisor) 0) true false))
(leap-year? 100) ;=> false
(leap-year? 200) ;=> false
(leap-year? 400) ;=> true
(leap-year? 12) ;=> true
(leap-year? 20) ;=> true
(leap-year? 15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment