28.3 IsEqualSet

IsEqualSet( list1, list2 )

IsEqualSet returns true if the two lists list1 and list2 are equal when viewed as sets, and false otherwise. list1 and list2 are equal if every element of list1 is also an element of list2 and if every element of list2 is also an element of list1.

If both lists are proper sets then they are of course equal if and only if they are also equal as lists. Thus IsEqualSet( list1, list2 ) is equivalent to Set( list1 ) = Set( list2 ) (see Set), but the former is more efficient.

    gap> IsEqualSet( [2,3,5,7,11], [11,7,5,3,2] );
    true
    gap> IsEqualSet( [2,3,5,7,11], [2,3,5,7,11,13] );
    false 

Previous Up Top Next
Index

GAP 3.4.4
April 1997