Haskell code, can you spot the bug ?

in programming •  7 years ago 

haskell_leap.png

So let me just tell what the algorithm is, for people who do not speak haskell.

the second line says
/= is unequal.

y modulo 4 = 0 OR y modulo 100 /= 0 AND y mod 400 = 0

Yes this is boolean algebra.

Fyi I have found the bug, I just thought this might be an interesting exercise.
I will probably update this later, or write a piece on what the bug is,
but that might not be a long article.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Okay the bug is with the order of the logical operators, the right way to do it would be to have not OR first, rather switch the logical operators.
The way this is written in haskell it evaluates lazy and since true OR false is always true this is just a bug.