[Issue 6718] "nWayUnion" => "nWayMerge", plus true nWayUnion

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 17 02:24:49 PDT 2017


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

--- Comment #10 from RazvanN <razvan.nitu1305 at 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

--


More information about the Digitalmars-d-bugs mailing list