public static function cartesian(Set $a, Set $b) : array
    {
        $cartesian = [];

        foreach ($a as $multiplier) {
            foreach ($b as $multiplicand) {
                $cartesian[] = new self(array_merge([$multiplicand], [$multiplier]));
            }
        }

        return $cartesian;
    }
public static function cartesian(Set $a, Set $b) : array
    {
        $cartesian = [];

        foreach ($a as $multiplier) {
            foreach ($b as $multiplicand) {
                $cartesian[] = new self(array_merge([$multiplicand], [$multiplier]));
            }
        }

        return $cartesian;
    }
public static function cartesian ( Set $ a , Set $ b ) : array { $ cartesian = [ ] ; foreach ( $ a as $ multiplier ) { foreach ( $ b as $ multiplicand ) { $ cartesian [ ] = new self ( array_merge ( [ $ multiplicand ] , [ $ multiplier ] ) ) ; } } return $ cartesian ; }
Creates the Cartesian product of A and B.

@param Set $a
@param Set $b

@return Set[]
Creates the Cartesian product of A and B .