[GAP Forum] Strange output

Stefan Kohl stefan at mcs.st-and.ac.uk
Fri Feb 8 10:10:25 GMT 2013


On Fri, February 8, 2013 9:10 am, Gordon Royle wrote:
> I have a simple program that uses SmallestImageSet to find the lex least representative
> of orbits of a graph on k-sets.
>
> The output has suddenly started to look odd, in that in among all the "regular" sets,
> there are sets that print out with a strange syntax
>
>
> [ 1, 5, 51 ]
> [ 1, 6 .. 11 ]
> [ 1, 6, 12 ]
>
> The set [ 1, 6 .. 11 ] is equal to [1, 6, 11] but why does it print this way?

The second list prints in this way because it is in `IsRangeRep' (as opposed
to `IsPlistRep'), and neither short ranges are automatically converted to
`IsPlistRep' nor the output routine deals with that special case. We have:

gap> l1 := [ 1, 6 .. 11 ];
[ 1, 6 .. 11 ]
gap> l2 := [ 1, 6, 11 ];
[ 1, 6, 11 ]
gap> l1=l2;
true
gap> IsPlistRep(l1);
false
gap> IsPlistRep(l2);
true
gap> IsRangeRep(l1);
true
gap> IsRangeRep(l2);
false
gap> TNUM_OBJ(l1);
[ 64, "list (range,ssort)" ]
gap> TNUM_OBJ(l2);
[ 54, "list (plain,cyc)" ]
gap> MemoryUsage(l1); # saves already a tiny bit of memory
28
gap> MemoryUsage(l2);
32
gap> l3 := [1,6..1000001];
[ 1, 6 .. 1000001 ]
gap> MemoryUsage(l3); # for longer ranges, more memory is saved
28
gap> MemoryUsage(AsSet(l3));
800024

If there is a real need, I guess at least the output routine could be
adjusted as to print [ 1, 6, 11 ] rather than [ 1, 6 .. 11 ].

Best regards,

    Stefan






More information about the Forum mailing list