# 28.9 Set Functions for Sets

As was already mentioned in the introduction to this chapter all domain functions also accept sets as arguments. Thus all functions described in the chapter Domains are applicable to sets. This section describes those functions where it might be helpful to know the implementation of those functions for sets.

`IsSubset( set1, set2 )`

This is implemented by `IsSubsetSet`, which you can call directly to save a little bit of time. Either argument to `IsSubsetSet` may also be a list that is not a proper set, in which case `IsSubset` silently applies `Set` (see Set) to it first.

`Union( set1, set2 )`

This is implemented by `UnionSet`, which you can call directly to save a little bit of time. Note that `UnionSet` only accepts two sets, unlike `Union`, which accepts several sets or a list of sets. The result of `UnionSet` is a new set, represented as a sorted list without holes or duplicates. Each argument to `UnionSet` may also be a list that is not a proper set, in which case `UnionSet` silently applies `Set` (see Set) to this argument. `UnionSet` is implemented in terms of its destructive counterpart `UniteSet` (see UniteSet).

`Intersection( set1, set2 )`

This is implemented by `IntersectionSet`, which you can call directly to save a little bit of time. Note that `IntersectionSet` only accepts two sets, unlike `Intersection`, which accepts several sets or a list of sets. The result of `IntersectionSet` is a new set, represented as a sorted list without holes or duplicates. Each argument to `IntersectionSet` may also be a list that is not a proper set, in which case `IntersectionSet` silently applies `Set` (see Set) to this argument. `IntersectionSet` is implemented in terms of its destructive counterpart `IntersectSet` (see IntersectSet).

The result of `IntersectionSet` and `UnionSet` is always a new list, that is not identical to any other list. The elements of that list however are identical to the corresponding elements of set1. If set1 is not a proper list it is not specified to which of a number of equal elements in set1 the element in the result is identical (see Identical Lists).

GAP 3.4.4
April 1997