Leap: implement basis
- Dominant language
- Go
- Stars
- 33
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
This is a common side exercise, probably because it looks (and is) pretty simple. Some people even attempt this before Two Fer.
Every solution, without exception, looks like this:
```go
func IsLeapYear(year int) bool {
return (year%4 == 0 && year%100 != 0) || year%400 == 0
}
```
(or some equivalent Boolean transformation). Fine as far as it goes, but there's a missed opportunity to make this code clear, simple, and readable, in a way that matches the English description of the problem. Something along these lines:
```go
func IsLeapYear(year int) bool {
if year%4 != 0 {
return false
}
if year%400 == 0 {
return true
}
if year%100 == 0 {
return false
}
return true
}
```
(Not saying this is the perfect solution, but it illustrates what I'm talking about.)
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no file or test. Start by locating the Go analysis entry point for the Leap exercise and compare the compact and expanded IsLeapYear forms shown. Done means the tool recognizes or supports the clearer conditional structure described in the issue, with tests covering the relevant forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100