https://issues.dlang.org/show_bug.cgi?id=6788
--- Comment #13 from Andrei Alexandrescu ---
I see in https://docs.python.org/2/library/itertools.html that the recipe given
for pairwise would produce the pairs (1, 2), (2, 3), and (3, 4) starting from
[1, 2, 3, 4]. So defining it
https://issues.dlang.org/show_bug.cgi?id=6788
--- Comment #12 from greenify ---
@andralex: I think there is also a decision-blocked PR pending in the Phobos
queue:
https://github.com/dlang/phobos/pull/4027
--
https://issues.dlang.org/show_bug.cgi?id=6788
Andrei Alexandrescu changed:
What|Removed |Added
Keywords||bootcamp
https://issues.dlang.org/show_bug.cgi?id=6788
Seb changed:
What|Removed |Added
CC||s...@wilzba.ch
--
https://issues.dlang.org/show_bug.cgi?id=6788
--- Comment #7 from hst...@quickfur.ath.cx ---
If order doesn't matter, then a series of nested loops should do what you want.
However, we can't actually use nested loops for a generic algorithm, since (1)
the nesting level depends on how many
https://issues.dlang.org/show_bug.cgi?id=6788
--- Comment #8 from bearophile_h...@eml.cc ---
(In reply to hsteoh from comment #7)
If order doesn't matter,
The order matters, this:
foreach (tup; iota(1, 5).pairwise)
tup.writeln;
Should print only in this order:
Tuple!(int,int)(1, 2)
https://issues.dlang.org/show_bug.cgi?id=6788
--- Comment #9 from bearophile_h...@eml.cc ---
This shows a simple use case of pairwise, to compute the pairs of closest
points of an array 2D points.
The function closestPair1 uses just a pair of loops.
closestPair2 uses cartesianProduct of all
https://issues.dlang.org/show_bug.cgi?id=6788
--- Comment #5 from hst...@quickfur.ath.cx ---
Hmm. Sounds like what you want is n-element subsets, rather than tuples
specifically. I'll see if I can find any good algorithms for n-subset
enumeration...
--
https://issues.dlang.org/show_bug.cgi?id=6788
--- Comment #6 from bearophile_h...@eml.cc ---
(In reply to hsteoh from comment #5)
Hmm. Sounds like what you want is n-element subsets, rather than tuples
specifically. I'll see if I can find any good algorithms for n-subset
enumeration...
Isn't
http://d.puremagic.com/issues/show_bug.cgi?id=6788
--- Comment #4 from bearophile_h...@eml.cc 2013-03-12 12:04:54 PDT ---
Basic version for a random access range:
import std.range: ForeachType, isRandomAccessRange, hasLength;
import std.traits: Unqual, isNarrowString;
import std.typecons:
http://d.puremagic.com/issues/show_bug.cgi?id=6788
--- Comment #1 from bearophile_h...@eml.cc 2013-02-07 09:33:12 PST ---
See also Issue 7128
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
http://d.puremagic.com/issues/show_bug.cgi?id=6788
hst...@quickfur.ath.cx changed:
What|Removed |Added
Status|NEW |RESOLVED
CC|
http://d.puremagic.com/issues/show_bug.cgi?id=6788
bearophile_h...@eml.cc changed:
What|Removed |Added
Status|RESOLVED|REOPENED
13 matches
Mail list logo