28.4 AddSet

AddSet( set, elm )

AddSet adds elm, which may be an elment of an arbitrary type, to the set set, which must be a proper set, otherwise an error will be signalled. If elm is already an element of the set set, the set is not changed. Otherwise elm is inserted at the correct position such that set is again a set afterwards.

    gap> s := [2,3,7,11];;
    gap> AddSet( s, 5 );  s;
    [ 2, 3, 5, 7, 11 ]
    gap> AddSet( s, 13 );  s;
    [ 2, 3, 5, 7, 11, 13 ]
    gap> AddSet( s, 3 );  s;
    [ 2, 3, 5, 7, 11, 13 ] 

RemoveSet (see RemoveSet) is the counterpart of AddSet.

Previous Up Top Next
Index

GAP 3.4.4
April 1997