Skip to content

Instantly share code, notes, and snippets.

@roine
Last active September 23, 2018 10:27
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 roine/a03c93bb43511d0a82d253a5d58b6f65 to your computer and use it in GitHub Desktop.
Save roine/a03c93bb43511d0a82d253a5d58b6f65 to your computer and use it in GitHub Desktop.
Efficient (but less readable) checking if Leap Year. sample: https://ellie-app.com/3qN2Njbf2VWa1, source: https://stackoverflow.com/a/11595914/966187
isLeapYear : Int -> Bool
isLeapYear year =
Bitwise.and year 3 == 0 && (not (modBy year 25 == 0) || Bitwise.and year 15 == 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment