Jump to page: 1 2
Thread overview
[Issue 6718] "nWayUnion" => "nWayMerge", plus true nWayUnion
Jul 13, 2017
RazvanN
Jul 17, 2017
RazvanN
Jul 17, 2017
RazvanN
Jul 17, 2017
RazvanN
October 14, 2016
https://issues.dlang.org/show_bug.cgi?id=6718

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp

--- Comment #7 from Andrei Alexandrescu <andrei@erdani.com> ---
nWayUnion shall stay, but we can add new and better names and alias nWayUnion to one of them.

--
July 13, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #8 from RazvanN <razvan.nitu1305@gmail.com> ---
So, how should we proceed here? Rename nWayUnion to nWayMerge and alias nWayUnion to it? If we do that we should probably deprecate nWayUnion.

--
July 16, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

--- Comment #9 from Andrei Alexandrescu <andrei@erdani.com> ---
(In reply to RazvanN from comment #8)
> So, how should we proceed here? Rename nWayUnion to nWayMerge and alias nWayUnion to it? If we do that we should probably deprecate nWayUnion.

@RazvanN, let's do this:

* rename nWayUnion to multiwayMerge

* rename struct NWayUnion to MultiwayMerge

* leave nWayUnion as an undocumented alias of multiwayMerge. Mention in the documentation that "...for backward compatibility, `multiwayMerge` is also available under the name `nWayUnion`, which will be deprecated. New code should use `multiwayMerge`." Coordinate with Sebastian and Vladimir about the exact text and layout.

That would be one PR. The second PR:

* add function multiwayUnion that actually performs the union (no repeats). A simple implementation is to pipe the result of multiwayMerge through uniq.

* add function multiwayIntersection that performs the intersection of multiple sets.

These pull requests would close this issue.

--
July 17, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

--- Comment #10 from RazvanN <razvan.nitu1305@gmail.com> ---
(In reply to Andrei Alexandrescu from comment #9)
> (In reply to RazvanN from comment #8)
> > So, how should we proceed here? Rename nWayUnion to nWayMerge and alias nWayUnion to it? If we do that we should probably deprecate nWayUnion.
> 
> @RazvanN, let's do this:
> 
> * rename nWayUnion to multiwayMerge
> 
> * rename struct NWayUnion to MultiwayMerge
> 
> * leave nWayUnion as an undocumented alias of multiwayMerge. Mention in the documentation that "...for backward compatibility, `multiwayMerge` is also available under the name `nWayUnion`, which will be deprecated. New code should use `multiwayMerge`." Coordinate with Sebastian and Vladimir about the exact text and layout.
> 
> That would be one PR. The second PR:
> 
> * add function multiwayUnion that actually performs the union (no repeats). A simple implementation is to pipe the result of multiwayMerge through uniq.
> 
> * add function multiwayIntersection that performs the intersection of multiple sets.
> 
> These pull requests would close this issue.

We already have setIntersection which, as bearophile pointed out, computes the bags intersection. Maybe we should also rename setIntersection to multiwayIntersection and use setIntersection for the newly added function. I know that this may break code but setIntersection is very misleading

--
July 17, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

--- Comment #11 from Andrei Alexandrescu <andrei@erdani.com> ---
>Maybe we should also rename setIntersection to multiwayIntersection

setIntersection has two inputs. "multiwayIntersection" would have multiple inputs (a range of ranges) and would be a distinct function with important uses and its own theory and practice (http://www.cs.toronto.edu/~tl/papers/wea06.pdf is a good overview).

--
July 17, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

--- Comment #12 from RazvanN <razvan.nitu1305@gmail.com> ---
(In reply to Andrei Alexandrescu from comment #11)
> >Maybe we should also rename setIntersection to multiwayIntersection
> 
> setIntersection has two inputs. "multiwayIntersection" would have multiple inputs (a range of ranges) and would be a distinct function with important uses and its own theory and practice (http://www.cs.toronto.edu/~tl/papers/wea06.pdf is a good overview).

If I understand correctly, setIntersection is going to do a bags intersection for just 2 ranges, while multiwayIntersection is going to be a generalization of set intersection (i.e. it will still do bags intersection)

--
July 17, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

--- Comment #13 from RazvanN <razvan.nitu1305@gmail.com> ---
(In reply to Andrei Alexandrescu from comment #11)
> >Maybe we should also rename setIntersection to multiwayIntersection
> 
> setIntersection has two inputs. "multiwayIntersection" would have multiple inputs (a range of ranges) and would be a distinct function with important uses and its own theory and practice (http://www.cs.toronto.edu/~tl/papers/wea06.pdf is a good overview).

Actually, looking at the implementation, it seems that setIntersection also has a variable number of inputs : https://dlang.org/phobos/std_algorithm_setops.html#setIntersection

--
July 17, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

--- Comment #14 from Andrei Alexandrescu <andrei@erdani.com> ---
(In reply to RazvanN from comment #13)
> (In reply to Andrei Alexandrescu from comment #11)
> > >Maybe we should also rename setIntersection to multiwayIntersection
> > 
> > setIntersection has two inputs. "multiwayIntersection" would have multiple inputs (a range of ranges) and would be a distinct function with important uses and its own theory and practice (http://www.cs.toronto.edu/~tl/papers/wea06.pdf is a good overview).
> 
> Actually, looking at the implementation, it seems that setIntersection also has a variable number of inputs : https://dlang.org/phobos/std_algorithm_setops.html#setIntersection

It has a number of inputs known during compilation. True "multi" set intersection takes a range of ranges, i.e. an arbitrary number of sets.

--
July 17, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

--- Comment #15 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/9efa504bdca2b2644375e86d3b1527170512b726 Fix Issue 6718 - nWayUnion => nWayMerge, plus true nWayUnion

https://github.com/dlang/phobos/commit/bdae5f08f3cf4ed153063ad1d9a07fbb5aa12668 Merge pull request #5620 from RazvanN7/Issue_6718

[WIP] Fix Issue 6718 - nWayUnion => nWayMerge, plus true nWayUnion merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>

--
August 16, 2017
https://issues.dlang.org/show_bug.cgi?id=6718

--- Comment #16 from github-bugzilla@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/9efa504bdca2b2644375e86d3b1527170512b726 Fix Issue 6718 - nWayUnion => nWayMerge, plus true nWayUnion

https://github.com/dlang/phobos/commit/bdae5f08f3cf4ed153063ad1d9a07fbb5aa12668 Merge pull request #5620 from RazvanN7/Issue_6718

--
« First   ‹ Prev
1 2