28.2 Set

Set( list )

Set returns a new proper set, which is represented as a sorted list without holes or duplicates, containing the elements of the list list.

Set returns a new list even if the list list is already a proper set, in this case it is equivalent to ShallowCopy (see ShallowCopy). Thus the result is a new list that is not identical to any other list. The elements of the result are however identical to elements of list. If list contains equal elements, it is not specified to which of those the element of the result is identical (see Identical Lists).

    gap> Set( [3,2,11,7,2,,5] );
    [ 2, 3, 5, 7, 11 ]
    gap> Set( [] );
    [  ] 

Previous Up Top Next
Index

GAP 3.4.4
April 1997