Skip to content

Fix Issue 6004 - std.range.unzip()#5701

Merged
dlang-bot merged 1 commit intodlang:masterfrom
RazvanN7:Issue_6004
Aug 24, 2017
Merged

Fix Issue 6004 - std.range.unzip()#5701
dlang-bot merged 1 commit intodlang:masterfrom
RazvanN7:Issue_6004

Conversation

@RazvanN7
Copy link
Collaborator

The original bug report requested the addition of the function unzip to phobos which is the opposite of zip. Fortunately, the function transversal exists (as @wilzbach pointed out) which can be used to solve the problem elegantly. I updated the docs to mention that this feature is called unzip in other languages and added the example posted in the bug report.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Auto-close Bugzilla Description
6004 std.range.unzip()

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

Thanks a lot for following up on this. I'm sadly on the road, so would you be so kind to add this as a new unittest?

assert(equal(ror, [ 2, 4 ][]));
assert(equal(ror, [ 2, 4 ]));

// full unzip
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please create a new public test for this? The comment will then be displayed as tile

import std.algorithm.iteration : map;
int[][] y = new int[][3];
y[0] = [1, 2, 3];
y[1] = [4, 5, 6];
Copy link
Contributor

Choose a reason for hiding this comment

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

You could have created the array directly as well

@RazvanN7
Copy link
Collaborator Author

@wilzbach Don't mention it. I addressed the comments, hope it's ok now.

@dlang-bot dlang-bot merged commit f5e80f1 into dlang:master Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants