Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 14, 2015 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 weaselcat <r9shackleford@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |r9shackleford@gmail.com --- Comment #1 from weaselcat <r9shackleford@gmail.com> --- I was looking for this in std.range and didn't find anything, came across this issue. Since this is about 4 years old, was anything like this ever implemented? -- |
September 07, 2015 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 Edwin van Leeuwen <edder@tkwsping.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |edder@tkwsping.nl --- Comment #2 from Edwin van Leeuwen <edder@tkwsping.nl> --- (In reply to weaselcat from comment #1) > I was looking for this in std.range and didn't find anything, came across this issue. > > Since this is about 4 years old, was anything like this ever implemented? I was wondering the same thing. -- |
September 18, 2015 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 --- Comment #3 from bearophile_hugs@eml.cc --- (In reply to weaselcat from comment #1) > I was looking for this in std.range and didn't find anything, came across this issue. > > Since this is about 4 years old, was anything like this ever implemented? There are plenty of old ERs in bugzilla. -- |
October 14, 2016 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |bootcamp CC| |andrei@erdani.com -- |
May 07, 2017 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 Ulrich Küttler <kuettler@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kuettler@gmail.com --- Comment #4 from Ulrich Küttler <kuettler@gmail.com> --- For forward ranges of tuples "unzip" can be implemented in a few lines. E.g. import std.typecons, std.algorithm, std.range; Tuple!(int,int) divMod(int n, int m) { return tuple(n / m, n % m); } auto unzip(Range)(Range r) if (isForwardRange!Range && isTuple!(ElementType!Range)) { import std.conv; auto generateElements(size_t length) { const s = iota(length) .map!(i => "r.map!(t => t[" ~ i.to!string ~ "])") .join(","); return "tuple(" ~ s ~ ")"; } alias T = ElementType!Range; return mixin(generateElements(T.Types.length)); } void main() { import std.stdio, std.array; auto rs = iota(1, 20).map!(m => divMod(20,m)).unzip(); writeln(rs[0].array); writeln(rs[1].array); } Not sure if this should go into phobos. -- |
July 19, 2017 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 Seb <greensunny12@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |greensunny12@gmail.com --- Comment #5 from Seb <greensunny12@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? -- |
July 25, 2017 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 --- Comment #6 from Andrei Alexandrescu <andrei@erdani.com> --- (In reply to Seb from comment #5) > > 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? Seb, could you please copy the example you wrote in transversal? Also mention the feature can be found in other languages with the name "unzip", thus making the term searchable. It would close this bug. Thanks! -- |
July 25, 2017 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|nobody@puremagic.com |greensunny12@gmail.com -- |
August 24, 2017 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 --- Comment #7 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/c7dbebe0df36ca83352dba28c6e0177008bf84ad Fix Issue 6004 - std.range.unzip() https://github.com/dlang/phobos/commit/f5e80f19b882e96ed5108fa62d87530517992f00 Merge pull request #5701 from RazvanN7/Issue_6004 Fix Issue 6004 - std.range.unzip() merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com> -- |
October 16, 2017 [Issue 6004] std.range.unzip() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6004 --- Comment #8 from github-bugzilla@puremagic.com --- Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/c7dbebe0df36ca83352dba28c6e0177008bf84ad Fix Issue 6004 - std.range.unzip() https://github.com/dlang/phobos/commit/f5e80f19b882e96ed5108fa62d87530517992f00 Merge pull request #5701 from RazvanN7/Issue_6004 -- |
Copyright © 1999-2021 by the D Language Foundation