Skip to content

Instantly share code, notes, and snippets.

@VoQn
Created September 25, 2010 14:40
Show Gist options
  • Save VoQn/596894 to your computer and use it in GitHub Desktop.
Save VoQn/596894 to your computer and use it in GitHub Desktop.
閏年判定とかいうの
leap :: Integral a => a -> Bool
leap y = let m = (== 0) . (mod y) in if m 100 then m 400 else m 4
{-
leap 3 -- False
leap 4 -- True
leap 5 -- False
leap 96 -- True
leap 100 -- False
leap 104 -- True
leap 300 -- False
leap 400 -- True
leap 500 -- False
-}
@VoQn
Copy link
Author

VoQn commented Sep 25, 2010

fix comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment