[GAP Forum] [Devel] Strange output

Laurent Bartholdi laurent.bartholdi at gmail.com
Sun Feb 10 06:25:37 GMT 2013


The [a, b .. c] in GAP means { a, b, 2b-a, ..., a+i(b-a), ..., c } in
mathematics.

GAP is not exactly a programming language; there are *objects* and their
*representations*, and GAP is allowed to change a representation to another
one in case it's provably more efficient (i.e. there are more or faster
algorithms for it).

Hope this helps,
Laurent


On Sun, Feb 10, 2013 at 5:58 AM, Dmitrii (Dima) Pasechnik
<dima at ntu.edu.sg>wrote:

> On 10 February 2013 10:52, Gordon Royle <gordon.royle at uwa.edu.au> wrote:
> > Well, thanks for the feedback, but I remain somewhat confused…
>
> I think this is definitely a bug, and must be fixed ASAP...
>
> Best,
> Dima
>
> >
> > 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>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Forum mailing list
> > Forum at mail.gap-system.org
> > http://mail.gap-system.org/mailman/listinfo/forum
>
> CONFIDENTIALITY:This email is intended solely for the person(s) named and
> may be confidential and/or privileged.If you are not the intended
> recipient,please delete it,notify us and do not copy,use,or disclose its
> content.
>
> Towards A Sustainable Earth:Print Only When Necessary.Thank you.
>
> _______________________________________________
> Devel mailing list
> Devel at gap-system.org
> http://mail.gap-system.org/mailman/listinfo/devel
>



-- 
Prof. Dr. Laurent Bartholdi   \ laurent.bartholdi<at>gmail<dot>com
G.-A. Universität zu Göttingen \ Phone: +49 551 39 7826
Bunsenstraße 3-5                \ Secr: +49 551 39 7752
D-37073 Göttingen, Germany       \ Fax: +49 551 39 22674


More information about the Forum mailing list