haskell: leap

This commit is contained in:
2021-09-09 10:59:03 -04:00
parent 8fe30a1a00
commit b1ec5d6b16
9 changed files with 272 additions and 0 deletions

View File

@ -0,0 +1,4 @@
module LeapYear (isLeapYear) where
isLeapYear year = hasFactor 4 && (not (hasFactor 100) || hasFactor 400)
where hasFactor n = year `rem` n == 0