28.6 UniteSet

UniteSet( set1, set2 )

UniteSet unites the set set1 with the set set2. This is equivalent to adding all the elements in set2 to set1 (see AddSet). set1 must be a proper set, otherwise an error is signalled. set2 may also be list that is not a proper set, in which case UniteSet silently applies Set to it first (see Set). UniteSet returns nothing, it is only called to change set1.

    gap> set := [ 2, 3, 5, 7, 11 ];;
    gap> UniteSet( set, [ 4, 8, 9 ] );  set;
    [ 2, 3, 4, 5, 7, 8, 9, 11 ]
    gap> UniteSet( set, [ 16, 9, 25, 13, 16 ] );  set;
    [ 2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 25 ] 

The function UnionSet (see Set Functions for Sets) is the nondestructive counterpart to the destructive procedure UniteSet.

Previous Up Top Next
Index

GAP 3.4.4
April 1997