-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
list-ops: append descriptions do not match inputs #1609
Comments
Problem: (these orderings are at odds with each other) {
"description": "empty list to list", //<-- the ordering described
"property": "append",
"input": {
"list1": [], // <-- the ordering of the inputs
"list2": [1, 2, 3, 4]
},
"expected": [1, 2, 3, 4]
},
{
"description": "non-empty lists",
"property": "append",
"input": {
"list1": [1, 2], // <-- the ordering of the inputs
"list2": [2, 3, 4, 5]
},
"expected": [1, 2, 2, 3, 4, 5] // <-- the ordering of the expected result
} Solution proposal 1: {
"description": "list to empty list", //<-- Change description
"property": "append",
"input": {
"list1": [],
"list2": [1, 2, 3, 4]
},
"expected": [1, 2, 3, 4]
},
{
"description": "non-empty lists",
"property": "append",
"input": {
"list1": [1, 2],
"list2": [2, 3, 4, 5]
},
"expected": [1, 2, 2, 3, 4, 5]
} Solution proposal 2: {
"description": "empty list to list",
"property": "append",
"input": {
"list1": [],
"list2": [1, 2, 3, 4]
},
"expected": [1, 2, 3, 4]
},
{
"description": "non-empty lists",
"property": "append",
"input": {
"list1": [1, 2],
"list2": [2, 3, 4, 5]
},
"expected": [2, 3, 4, 5, 1, 2] //<-- Change expected result ordering
} Solution proposal 3: {
"description": "empty list to list",
"property": "append",
"input": {
"list1": [1, 2, 3, 4] //<-- change order of inputs
"list2": [],
},
"expected": [1, 2, 3, 4]
},
{
"description": "non-empty lists",
"property": "append",
"input": {
"list1": [1, 2],
"list2": [2, 3, 4, 5]
},
"expected": [1, 2, 2, 3, 4, 5]
} Solution 3 seems like the best to me. |
I see. Changing the description to I think solution 2 looks a little unintuitive given the name of It does not appear that I need to specify my preference between solution 1 or 3 at this moment. A potential future direction: One could argue that both cases are worth testing. "input": {
"list1": [],
"list2": [1, 2, 3, 4]
}, "input": {
"list1": [1, 2, 3, 4],
"list2": []
}, I would surmise that fixing the current test (whatever that fix may be) is not embargoed, but adding a new test would be. Therefore, my suggestion would be to submit those as separate PRs, so that the fix can be merged when it gets the approvals, and the additional test can be merged after the embargo is lifted. |
To my reading both expect the contents of
As described Solution 2 would, therefore, represent a prepend, since the items in the second list end up before the items in the first. And, in a language with mutation, the identity of the object returned would be incorrect. As stated there's no real ambiguity then with the The proposed Solution 1 does seem to improve the meaning since the description becomes "[append a non-empty] list to [an] empty list", which is easier to understand than the existing description (which is indeed ambiguous) so I'd tend to vote for that one. Solution 3 is somewhat moot because if the existing case isn't also included, as per @petertseng ... however both the proposed Solution 3 and adding the mirror case would currently be blocked by #1560. |
Per exercism/problem-specifications#1609, this change makes the ordering of inputs implied by the description match the inputs as they are actually supplied. This bumps the version from 2.4.0 to 2.4.1. This change reflects exercism/problem-specifications#1611
In the
canonical-data.json
for thelist-ops
exercise test case 2 and 3 have descriptions that are conflicting, given the associated inputs.In the
append entries to a list and return the new list
cases:list1
input to be appended tolist2
inputlist2
input to be appended tolist1
input(This is based on the description and the ordering of the values in the expected output..)
Any given implementation can only either append or prepend, but not arbitrarily chose one of append or prepend. Given the name of the cases relates to appending, I understand that append is what was intended, but this is not what these test cases imply.
Additional notes on reading the spec by someone who doesn't know functional operations:
x
ory
? This makes understanding the division operations harder than it should be.The text was updated successfully, but these errors were encountered: