Skip to content

ring: require >=4 points to return true when calling Closed()#70

Merged
paulmach merged 1 commit intopaulmach:masterfrom
missinglink:ring_closed
Oct 12, 2021
Merged

ring: require >=4 points to return true when calling Closed()#70
paulmach merged 1 commit intopaulmach:masterfrom
missinglink:ring_closed

Conversation

@missinglink
Copy link
Copy Markdown
Contributor

this PR requires a minimum of 4 points for ring.Closed() to return true (as per existing code comment).

note: the current implementation will panic on an empty ring:

panic: runtime error: index out of range [0] with length 0

@missinglink
Copy link
Copy Markdown
Contributor Author

I was considering rewriting r[0] == r[len(r)-1] as r[0].Equal(r[len(r)-1]) but I guess it's working fine as-is and probably faster this way 🤷‍♂️

@paulmach
Copy link
Copy Markdown
Owner

Thank you!

@paulmach paulmach merged commit 31e3227 into paulmach:master Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants