[GAP Forum] Strange output

Gordon Royle gordon.royle at uwa.edu.au
Sun Feb 10 02:52:02 GMT 2013


Well, thanks for the feedback, but I remain somewhat confused…

Firstly,  why does GAP unilaterally choose to change the format .. .the program is simply a recursive program with a single Print statement, and yet the output changes format , and then changes back again, without me asking it to...

[ 1, 5, 51 ]
[ 1, 6 .. 11 ]
[ 1, 6, 12 ]




Secondly, why is

6 .. 11

the "range representation" for

6, 11

In most languages that support it, the ".." means "everything from the first to the last (or perhaps the first to the last-minus-one)"


Actually, it means the same in GAP too:

gap> for x in [6 .. 11] do
> Print(x," ");
> od;
6 7 8 9 10 11

So, naively I would expect

[1, 6 .. 11]

to be a fancy way of saying

[1, 6, 7, 8, 9, 10, 11]


But it's not:

gap> for x in [1, 6 .. 11] do
> Print(x," ");
> od;
1 6 11


It seems dangerous to me to have the expression   a .. b mean something different to (a) other uses in the same language, (b) mathematical usage and (c ) other programming languages.


Thirdly, why has this happened RIGHT NOW, when I've been using this program for years without ever seeing anything like this before…


Thanks again

Gordon



Professor Gordon Royle
School of Mathematics and Statistics
University of Western Australia
Gordon.Royle at uwa.edu.au<mailto:Gordon.Royle at uwa.edu.au>















More information about the Forum mailing list