Skip to content

Triangle cleanup#233

Merged
kytrinyx merged 2 commits intoexercism:masterfrom
petertseng:triangle-cleanup
Jan 30, 2016
Merged

Triangle cleanup#233
kytrinyx merged 2 commits intoexercism:masterfrom
petertseng:triangle-cleanup

Conversation

@petertseng
Copy link
Copy Markdown
Member

I know examples don't need to be the best code, but

  • this was bugging me while I was looking at the example code for triangle: incorrect test in some tracks #231 so I decided to fix it
  • even if the code is unabashedly not the best, I say there's still no harm in increasing readability (which I argue this does)

Since they're sorted, if a == c, then this is an equilateral triangle.
If not, then we only need to check whether a == b or b == c, which will
make it isosceles, else it's scalene.

This flattens the switch/case structure, and compresses two isosceles
cases into one, so overall it seems easier to understand.
@petertseng
Copy link
Copy Markdown
Member Author

Strictly speaking this needn't conflict with #232 since they don't touch the same lines but I just tried to merge the two locally and git plays it safe and declares there is a merge conflict (since the edited lines are just one line apart). So if you care about merging both in quick succession you can deal with the conflict in the obvious way. I can deal with the rebase if it's OK to merge them a few hours apart, of course (and I argue that it's totally OK to merge this one later)

@kytrinyx
Copy link
Copy Markdown
Member

This is all good! Thanks for fixing :)

kytrinyx added a commit that referenced this pull request Jan 30, 2016
@kytrinyx kytrinyx merged commit a891a39 into exercism:master Jan 30, 2016
@petertseng petertseng deleted the triangle-cleanup branch January 30, 2016 15:58
ErikSchierboom pushed a commit to ErikSchierboom/go that referenced this pull request Jan 26, 2021
* List of Go concepts needed to solve the v2 two fer exercise

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Gabriel Nelle <tehsphinx@web.de>

* an vs. a when next word starts with vowel

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* apply change suggestion

Co-authored-by: Victor Goff <keeperotphones@gmail.com>
Co-authored-by: Gabriel Nelle <tehsphinx@web.de>
Co-authored-by: John Arundel <john@bitfieldconsulting.com>
ErikSchierboom pushed a commit to ErikSchierboom/go that referenced this pull request Jan 27, 2021
* List of Go concepts needed to solve the v2 two fer exercise

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Gabriel Nelle <tehsphinx@web.de>

* an vs. a when next word starts with vowel

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* apply change suggestion

Co-authored-by: Victor Goff <keeperotphones@gmail.com>
Co-authored-by: Gabriel Nelle <tehsphinx@web.de>
Co-authored-by: John Arundel <john@bitfieldconsulting.com>
ErikSchierboom pushed a commit to ErikSchierboom/go that referenced this pull request Jan 28, 2021
* List of Go concepts needed to solve the v2 two fer exercise

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Gabriel Nelle <tehsphinx@web.de>

* an vs. a when next word starts with vowel

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: Victor Goff <keeperotphones@gmail.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* Update languages/reference/exercise-concepts/two-fer.md

Co-Authored-By: John Arundel <john@bitfieldconsulting.com>

* apply change suggestion

Co-authored-by: Victor Goff <keeperotphones@gmail.com>
Co-authored-by: Gabriel Nelle <tehsphinx@web.de>
Co-authored-by: John Arundel <john@bitfieldconsulting.com>
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