Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
add min, max, range, distances #196
Conversation
|
Overall, you are naming things not really good, trying to see this doc as reference: https://github.com/unknwon/go-code-convention/blob/master/en-US/naming_rules.md#:~:text=Variable%20name%20is%20generally%20using,e.g.%20APIClient%20%2C%20repoID%20%2C%20UserID%20. Also, find a more meaningful variable name for your variables. |
| ) | ||
|
|
||
| // absolute value, also implemented in "math" as math.Abs | ||
| func abs(a float64) float64 { |
nomisrevol
Oct 7, 2020
Collaborator
Please reuse the existence function.
Please reuse the existence function.
| return max(numbers) - min(numbers) | ||
| } | ||
|
|
||
| func main() { |
nomisrevol
Oct 7, 2020
Collaborator
Remove the main function and write the test file instead.
Remove the main function and write the test file instead.
| } | ||
|
|
||
| //find the largest distance from 0 | ||
| func maxDist(numbers []float64) float64 { |
nomisrevol
Oct 7, 2020
Collaborator
Should rename to maxDistToZero, I think it is more meaningful.
Should rename to maxDistToZero, I think it is more meaningful.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

added min, min distance from 0, max, max distance from 0 and range on a list of numbers