IsRange( obj )
IsRange
returns true
if obj, which may be an object of any type, is
a range and false
otherwise. A range is a list without holes such that
the elements are integers with a constant increment. Will cause an error
if obj is an unassigned variable.
gap> IsRange( [1,2,3] ); true # this list is a range gap> IsRange( [7,5,3,1] ); true # this list is a range gap> IsRange( [1,2,4,5] ); false # this list is a set and a vector, but not a range gap> IsRange( [1,,3,,5,,7] ); false # this list contains holes gap> IsRange( 1 ); false # is not even a list gap> IsRange( [] ); true # the empty list is a range by definition gap> IsRange( [1] ); true # singleton lists are a range by definition too
GAP 3.4.4