complement

..  complement(s)

Returns the set-complement of :obj:`IntSet` ``s``.

Examples

julia> foo = IntSet([1:125]);
julia> bar = complement(foo);

julia> for i in bar
        if(i <= 128)
            println(i);
        else
            break;
        end
    end
0
126
127
128
"""
complement(s)

Returns the set-complement of IntSet `s`.
"""
function complement(s::IntSet)
    return ~s
end

Example usage:

julia> set1 = IntSet(1:5)
IntSet([1, 2, 3, 4, 5])

julia> complement(set1)
IntSet([0, 6, 7, 8, 9])

This example demonstrates how to use the complement function to obtain the set-complement of an IntSet. The function complement takes an IntSet as input and returns a new IntSet that contains all the integers not present in the original set s.

See Also

complement, complement!, intersect, intersect!, issubset, selectperm, selectperm!, Set, setdiff, setdiff!, symdiff, union, union!,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: