https://issues.dlang.org/show_bug.cgi?id=6788

Seb <greensunn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greensunn...@gmail.com
            Summary|std.range.pairwise          |std.algorithm.combinations

--- Comment #14 from Seb <greensunn...@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)

--

Reply via email to