transpose: Align 'test many lines' expected result with javascript 'many lines' test#371
transpose: Align 'test many lines' expected result with javascript 'many lines' test#371SleeplessByte merged 3 commits intoexercism:masterfrom peerreynders:master
Conversation
…script 'many lines' test expected and update example implementation to match.
|
Quick question, do you know why a few of the package.json are changed from |
SleeplessByte
left a comment
There was a problem hiding this comment.
Changes look sensical. Thank you for doing the work.
See inline comment and PR question.
| ).toEqual(expected) | ||
| }) | ||
|
|
||
| xit("jagged triangle", () => { |
There was a problem hiding this comment.
Only request I have is to also push this addition to problem-specifications.
- generate a uuid (google a generator, generate one, or use
configlet uuidif you haveconfiglet) - add it to
.meta/tests.toml - PR it to this file.
I'm also in that repo, the process won't be lengthy to get it merged there.
There was a problem hiding this comment.
A.) problem-specification pull request: exercism/problem-specifications#1748
In hindsight you specified a range - did you want to replace the "triangle" test with "jagged triangle"?
Because I simply added a new test at the end.
B.) added the uuid to the tests.toml
C.) "package.json are changed from 100644 → 100755"?
It's something that must have happened when I ran through the lint, test, sync, ci-check, ci scripts.
There was a problem hiding this comment.
C) Yeah it was possibly wrong already 💯 . I fixed it :)
There was a problem hiding this comment.
A) as you've done it right now looks perfect to me.
|
Thank you @peerreynders |
See #199 (comment)
Core changes:
Opinionated Changes:
(1) Provided a reference implementation that relies on more rudimentary language primitives to satisfy the tests. The objective is not to provide some kind of a "gold standard" but instead to provide a specimen that together with "descriptive and meaningful names" can be easily understood by a beginning student while being easily improved upon by an intermediate student. This may not be desirable if the reference implementation is used as a mentoring aid.
The last example implementation (for me personally at least) was terse enough to require significant scratch refactoring to locate the root cause of the problem:
What confused the issue was that
Array.prototype.mapwas used for side effects (replaced above withforEach) and to some degree thatreducemutated the accumulator rather than recreating it with modifications (in the spirit ofmapandfilter).The revised reference implementation stays with mutation (which in this small scope is often judged to be easier to understand despite the hazards on a larger scale) and uses
forloops to stay with the theme.The reference implementation doesn't reflect my personal taste - I kind of landed on:
(2) Changed the
transposeimplementation from a static class method to a simple function in both the tests and reference implementation. Given whattransposeis doing and how the tests use it a class seems to be an awkward representation of the capability - a function exported by the module seems more appropriate. To make this very clear the startertranspose.tsalready includes a function implementation that passes the first test.(3) Added the "jagged triangle" test. This small test case demonstrates the problem that the previous reference implementation had much more clearly than the final "test many lines" test case.