Change leap to stateless (issue #353)#354
Conversation
exercises/leap/example.scala
Outdated
| divisibleBy(year, 4) && (divisibleBy(year, 400) || !divisibleBy(year, 100)) | ||
|
|
||
| private def divisibleBy(i: Int) = year % i == 0 | ||
| private def divisibleBy(year: Int, i: Int) = year % i == 0 |
There was a problem hiding this comment.
You could consider to have this as a nested function inside isLeap so that you can omit the year parameter again.
| @@ -0,0 +1,3 @@ | |||
| object Year { | |||
There was a problem hiding this comment.
Now this touches an interesting subject:
Some time ago we decided in issue #137 to have such a file with the expected functions for the first 10 exercises.
leap was originally not among those, but now after the reordering according to difficulty it is.
So I think to add this file is just fine. Am I right, @ricemery @ErikSchierboom ? Maybe we should also review the other affected exercises under this aspect?
There was a problem hiding this comment.
@abo64 As far as I can recall: yes, you are right. I think reviewing the other exercises makes sense.
1d280ab to
7d55832
Compare
|
well I know this is a tiny change, but there is anything else to be done in the pr? does this closses issue #353 ? (I think it suggests new issues but any way) |
|
Thank you @zombiefungus |
No description provided.