[Issue 6788] std.algorithm.combinations
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 9 11:54:47 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=6788
Seb <greensunny12 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |greensunny12 at gmail.com
Summary|std.range.pairwise |std.algorithm.combinations
--- Comment #14 from Seb <greensunny12 at 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)
--
More information about the Digitalmars-d-bugs
mailing list