jakewhiteley/php-sets

add setOfSets method

ESCA7A opened this issue · 0 comments

ESCA7A commented

hi, friend

Your module lacks enumeration of all intersections (like a crossjoin but more)
what I mean? We have sets:

$set1 = ['a', 'b'];
$set2 = ['c', 'd'];
$set3 = ['e', 'f'];

$result = setOfSets($set1, $set2, $set3);

// OUTPUT ------------------------------------------------
print_r($result);
[
    // cross a
    [
        'a', 'ab', 'ac', 'ad', 'ae', 'af',
        'abc', 'abd', 'abe', 'abf'
        'abcd', 'abce', 'abcf',
        'abcde', 'abcdf',
        'abcdef',
    ],
    // cross b
    [
        'b', ba', 'bc', 'bd', 'bd', 'be', 'bf',
        'bac', 'bad', 'bae', 'baf',
        'bacd', 'bace', 'bacf',
        'bacde', 'bacdf',
        'bacdef',
    ]
                    
    ...and more...
...
]

Adding this update would be a great solution