[Issue 6004] std.range.unzip()

2017-10-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

--- Comment #8 from github-bugzi...@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

--


[Issue 6004] std.range.unzip()

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

--- Comment #7 from github-bugzi...@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.wilzb...@gmail.com>

--


[Issue 6004] std.range.unzip()

2017-07-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

Andrei Alexandrescu  changed:

   What|Removed |Added

   Assignee|nob...@puremagic.com|greensunn...@gmail.com

--


[Issue 6004] std.range.unzip()

2017-07-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

--- Comment #6 from Andrei Alexandrescu  ---
(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!

--


[Issue 6004] std.range.unzip()

2017-07-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #5 from Seb  ---
> 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?

--


[Issue 6004] std.range.unzip()

2017-05-07 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

Ulrich Küttler  changed:

   What|Removed |Added

 CC||kuett...@gmail.com

--- Comment #4 from Ulrich Küttler  ---
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.

--


[Issue 6004] std.range.unzip()

2016-10-14 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

Andrei Alexandrescu  changed:

   What|Removed |Added

   Keywords||bootcamp
 CC||and...@erdani.com

--


[Issue 6004] std.range.unzip()

2015-09-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

--- Comment #3 from bearophile_h...@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.

--


[Issue 6004] std.range.unzip()

2015-09-07 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

Edwin van Leeuwen  changed:

   What|Removed |Added

 CC||ed...@tkwsping.nl

--- Comment #2 from Edwin van Leeuwen  ---
(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.

--


[Issue 6004] std.range.unzip()

2015-05-14 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

weaselcat r9shacklef...@gmail.com changed:

   What|Removed |Added

 CC||r9shacklef...@gmail.com

--- Comment #1 from weaselcat r9shacklef...@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?

--