October 15, 2016 [Issue 6788] std.range.pairwise | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6788 --- Comment #12 from greenify <greeenify@gmail.com> --- @andralex: I think there is also a decision-blocked PR pending in the Phobos queue: https://github.com/dlang/phobos/pull/4027 -- | ||||
November 07, 2017 [Issue 6788] std.range.pairwise | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6788 --- Comment #13 from Andrei Alexandrescu <andrei@erdani.com> --- 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 with different semantics is potentially confusing. The functionality proposed is really "combinations of 2 elements in the given range". In general we'd be looking at combinations of k elements of the given range, yielding a range of k-tuples. See https://en.wikipedia.org/wiki/Combination Fittingly enough, Python offers https://docs.python.org/2/library/itertools.html#itertools.combinations and https://docs.python.org/2/library/itertools.html#itertools.combinations_with_replacement I think ws should define a function as follows: auto combinations(uint k, Flag!"Duplicates" f = Duplicates.no, R)(R range); The function returns a range of k-tuples containing combinations of elements in the range. Depending on the flag, duplicates are present or not. -- | ||||
February 09, 2018 [Issue 6788] std.algorithm.combinations | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6788 Seb <greensunny12@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |greensunny12@gmail.com Summary|std.range.pairwise |std.algorithm.combinations --- Comment #14 from Seb <greensunny12@gmail.com> --- > 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 with different semantics is potentially confusing. Yes, especially now that we have pairwise as slides. > I think ws should define a function as follows: > auto combinations(uint k, Flag!"Duplicates" f = Duplicates.no, R)(R range); > The function returns a range of k-tuples containing combinations of elements in the range. Depending on the flag, duplicates are present or not. +1 (renamed accordingly) @ students - see also: http://docs.mir.dlang.io/latest/mir_combinatorics.html (this is my module, it can be ported) -- | ||||
February 09, 2018 [Issue 6788] std.algorithm.combinations | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6788 --- Comment #15 from Seb <greensunny12@gmail.com> --- *** Issue 13039 has been marked as a duplicate of this issue. *** -- | ||||
April 03, 2022 [Issue 6788] std.algorithm.combinations | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6788 tyckesak <josipp@live.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED CC| |josipp@live.de Resolution|--- |DUPLICATE --- Comment #16 from tyckesak <josipp@live.de> --- Obviated by the introduction of `std.algorithm.setops.cartesianProduct` into the standard library. *** This issue has been marked as a duplicate of issue 7128 *** -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply