-
-
Notifications
You must be signed in to change notification settings - Fork 171
transpose: Align 'test many lines' expected result with javascript 'many lines' test #371
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,18 @@ | ||
| class Transpose { | ||
| public static transpose(lines: string[]): string[] { | ||
| return lines.reduce((result: string[], line, lineNo) => { | ||
| line.split("").map((value, key) => { | ||
| if (typeof result[key] === "undefined") { | ||
| result[key] = new Array(lineNo + 1).join(" ") | ||
| } | ||
| const fillColumn: (t: string[], l: string, r: number) => void = | ||
| (transposed, fromSource, toColumn) => { | ||
| for (let row = 0; row < fromSource.length; row++) { | ||
| transposed[row] = | ||
| (row in transposed ? transposed[row] : '').padEnd(toColumn) + | ||
| fromSource.charAt(row) | ||
| } | ||
| } | ||
|
|
||
| result[key] += value | ||
| }) | ||
| function transpose(lines: string[]): string[] { | ||
| const transposed: string[] = [] | ||
| for (let toColumn = 0; toColumn < lines.length; toColumn++) | ||
| fillColumn(transposed, lines[toColumn], toColumn) | ||
|
|
||
| return result | ||
| }, []) | ||
| } | ||
| return transposed | ||
| } | ||
|
|
||
| export default Transpose | ||
| export default transpose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| function transpose(_lines: string[]): string[] { | ||
| return [] | ||
| } | ||
|
|
||
| export default transpose |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only request I have is to also push this addition to
problem-specifications.configlet uuidif you haveconfiglet).meta/tests.tomlI'm also in that repo, the process won't be lengthy to get it merged there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C) Yeah it was possibly wrong already 💯 . I fixed it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A) as you've done it right now looks perfect to me.