Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pascals-triangle: Added test prototypes and more README info. #963

Merged
merged 7 commits into from
Nov 6, 2017

Conversation

hekrause
Copy link
Contributor

In relation to this pull request, where it was mentioned that fewer test greater 4 rows would not be needed.

To see the structure of the algorithm I wrote myself a few additional tests because I had my difficulties with getting a grip on the "pascals-triangle" exercise.

Maybe they are not necessary to solve this exercise but they do no harm.
I implemented the tests in this pull request and now made the corresponding changes in this repository.

@rpottsoh
Copy link
Member

@hekrause I haven't looked this all over, but it appears that you have an extra file in the commit that doesn't belong.

@hekrause
Copy link
Contributor Author

@rpottsoh You are right! Some left overs from another issue. :-)

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I said in exercism/rust#274 (comment) in April that a row >= 5 is the first row where 1 is not one of the addends. That could be a reason to add it.

I have no arguments in favour of additional cases beyond that.

As written, it doesn't seem like good ordering to have -1 between 4 and 5. I would keep -1 at the end.

Test version must be increased.

1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the alignment between this row and the one above is no longer effective because 10 has two digits

@Insti
Copy link
Contributor

Insti commented Oct 19, 2017

Thanks for writing a good description of the PR ❤️

1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you want to add this row?

I think the first 5 rows demonstrate the triangle sufficently, and adding 2 digit numbers makes the formatting difficult. The current formatting is not correctly triangular.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not replying on your comment.
Ah i wrote this line for me because i wanted simply more example data and then thought it would make no big difference because somehow the alignment is nearly symmetric.
@Insti So you think it is better to leave it unchanged?

Copy link
Contributor

@Insti Insti Nov 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, unchanged is better.

There are MANY other easily searchable resources that provide further information on Pascal's triangle and more example rows if that is what the student wants.

@Insti
Copy link
Contributor

Insti commented Oct 19, 2017

I go back and forth on whether adding test cases that can be passed without changing any code is a good idea or not, but in this case adding the extra cases 5,6,10 doesn't seem too bad.

@petertseng
Copy link
Member

petertseng commented Oct 20, 2017

I am kind of thinking the way I would test pascal's triangle would be to test that ∀n in [0..20] pascals_triangle(n) == precomputed_pascals_triangle[0..n) or something. I would probably tire of writing all of the cases in the JSON file but I am thinking that's how I would write the test file anyway. Shrug. So I guess I don't care about whether this is here.

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder: version 1.2.0

Copy link
Contributor

@Insti Insti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave the description unchanged.

@petertseng petertseng dismissed their stale review November 1, 2017 16:24

now version 1.2.0

1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when there were only single-digit numbers, it was the case that no number is directly above another.

but right now, there is a 1 directly above each 5, and there is a 4 directly above each 10

so this example is not currently showing the nature of the triangle

It is possible that this could be fixed. If it were, that would be better.

some possible solutions involve an unequal number of spaces in each gap in the same row. the resulting inconsistency raises questions about whether the relationship is different simply because of the difference in representation.

If a sixth row is to be added, such concerns should be addressed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that adding the line makes reading the triangle harder, while not providing much benefit I feel. @hekrause would you be opposed to removing the extra line?

@hekrause
Copy link
Contributor Author

hekrause commented Nov 5, 2017

@Insti I reset the description.

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed

I have given my justification for why it is appropriate to add five rows.

I have no justifications for adding six or ten rows, so this comment passes no judgment on them.

It is my belief that all rows added have the correct values.

My approval is conditional on the Squash and Merge button being used OR the commits being squashed using any other way.

Copy link
Contributor

@Insti Insti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these extra test are necessary, but they're also not harmful to add.

Since the description is now unchanged, I can approve.

@Insti Insti merged commit 2895b2b into exercism:master Nov 6, 2017
@Insti
Copy link
Contributor

Insti commented Nov 6, 2017

Thanks @hekrause ❤️

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.

5 participants