[Issue 6004] std.range.unzip()
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 19 11:38:47 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=6004
Seb <greensunny12 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |greensunny12 at gmail.com
--- Comment #5 from Seb <greensunny12 at gmail.com> ---
> For forward ranges of tuples "unzip" can be implemented in a few lines. E.g.
That's pretty sweet! I actually built something on top of this and was about to
submit it:
https://github.com/dlang/phobos/compare/master...wilzbach:unzip
But then I realized that std.range.transversal already solves this nicely:
import std.algorithm, std.range, std.stdio;
int[][] x = new int[][3];
x[0] = [1, 2, 3];
x[1] = [4, 5, 6];
x.transversal(1).writeln; // [2, 5]
x.front.walkLength.iota.map!(i => transversal(x, i)).writeln; // [[1, 4], [2,
5], [3, 6]]
Plat with this online: https://is.gd/YYCgPk
So I'm inclined to close this as WORKSFORME - other opionions?
--
More information about the Digitalmars-d-bugs
mailing list