28.1 IsSet

IsSet( obj )

IsSet returns true if the object obj is a set and false otherwise. An object is a set if it is a sorted lists without holes or duplicates. Will cause an error if evaluation of obj is an unbound variable.

    gap> IsSet( [] );
    true
    gap> IsSet( [ 2, 3, 5, 7, 11 ] );
    true
    gap> IsSet( [, 2, 3,, 5,, 7,,,, 11 ] );
    false        # this list contains holes
    gap> IsSet( [ 11, 7, 5, 3, 2 ] );
    false        # this list is not sorted
    gap> IsSet( [ 2, 2, 3, 5, 5, 7, 11, 11 ] );
    false        # this list contains duplicates
    gap> IsSet( 235711 );
    false        # this argument is not even a list 

Up Top Next
Index

GAP 3.4.4
April 1997