28.8 SubtractSet

SubtractSet( set1, set2 )

SubtractSet subtracts the set set2 from the set set1. This is equivalent to removing all the elements in set2 from set1 (see RemoveSet). set1 must be a proper set, otherwise an error is signalled. set2 may be a list that is not a proper set, in which case SubtractSet applies Set to it first (see Set). SubtractSet returns nothing, it is only called to change set1.

    gap> set := [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ];;
    gap> SubtractSet( set, [ 6, 10 ] );  set;
    [ 2, 3, 4, 5, 7, 8, 9, 11 ]
    gap> SubtractSet( set, [ 9, 4, 6, 8 ] );  set;
    [ 2, 3, 5, 7, 11 ] 

The function Difference (see Difference) is the nondestructive counterpart to destructive the procedure SubtractSet.

Previous Up Top Next
Index

GAP 3.4.4
April 1997