Closed Smoren closed 1 year ago
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Totals | |
---|---|
Change from base Build 3921770479: | 0.09% |
Covered Lines: | 322 |
Relevant Lines: | 325 |
@markrogoyski
Hi Mark!
FYI: I moved unique-mapping logic into the separate repository: https://github.com/Smoren/unique-php
Added missing behaviors and fixed bugs during testing.
Rebased from branch "develop".
@markrogoyski
FYI: I've moved UniqueExtractor
from unique-php to type-tools-php.
Hi @markrogoyski
I've rebased this branch from develop
and resolved conflicts.
BTW I've a little bit changed unique extracting logic in my repo.
If you find a way to include this logic to IterTools we can implement such functionality as e. g. Single::intersection()
and Single::difference()
.
use IterTools\Single;
$lhs = [1, 2, 3, 4, 5];
$rhs = [3, 4, 5, 6, 7];
$intersection = Single::intersection($lhs, $rhs);
foreach ($intersection as $item) {
// 3, 4, 5
}
What do you think about it?
UPD: I've rebased this branch from develop
.
Hi @Smoren,
Apologies for the delay in responding.
How about changing the name to distinct
and drop the "filter" prefix. Distinct usually means removing duplicates, whereas unique can imply only selecting the items that only appear once.
Thanks, Mark
Hi @markrogoyski
Thank you for your suggestion!
Summary of changes:
Single::filterUnique()
renamed to Single::distinct()
.Util\UniqueExtractor
added and used in Single::distinct()
.FilterUniqueTest
renamed to DistinctTest
.Stream::distinct()
method added and covered by tests.@markrogoyski
BTW, what do you think about separate namespace for distinct
, intersection
, difference
and other operations with sets?
Hi @Smoren,
What is your suggestion here. Maybe Set::distinct($data)
, Set::intersection($set1, $set2)
, etc.?
Hi @markrogoyski,
Set
created.Single::distinct()
moved into namespace Set
.DistinctTest
moved into Set
directory.Stream::distinct()
moved into separate test Stream\SetTest
.UPD: this branch is rebased from develop
.
Single::filterUnique()
added;Single/FilterUniqueTest.php
added;