[GAP Forum] Is this “loop” in GAP applicable?

Alexander Konovalov alexander.konovalov at gmail.com
Wed Dec 7 21:46:29 GMT 2011


P.S. Sorry, I was too quick with my reply - actually, it works even without 
spaces in "in[2..5]do" with the latest official release GAP 4.4.12, as well
as in the beta release of GAP 4.5 (though, of course, it's not the recommended
way to write the GAP code, and if 'list-expr' is not a plain list but a domain,
clearly one has to use spaces).

So, if an error occurs because of another reason, are you sure that you're 
using the latest version of GAP? Also, which GAP distribution did you use to 
install it? Can you reproduce this problem in a new GAP session? Could you
let me know this, please?

Thanks,
Alexander


On 7 Dec 2011, at 20:25, Alexander Konovalov wrote:

> 
> On 7 Dec 2011, at 18:59, Mr. Sorouhesh wrote:
> 
>> I am new (unskilled) in this software, the GAP, and wanted to generate for
>> example 4 groups as follows. Although the rules are used as it is its help;
>> I cannot see the 4 finitely presented groups generated.
>> 
>> f:=FreeGroup(2);;
>> 
>> a:=f.1; b:=f.2;
>> 
>> for k in[2..5]do G:=f/[a^2,b^k,(a*b)^3]; od;
>> 
>> Syntax error, unexpected od, expecting ';'
>> 
>> I think "for" cannot be applied for such these statements as I put above
>> (G:=....). Any suggestion? :-)
> 
> You have to put spaces around [2..5] in the last line:
> 
> 	for k in [2..5] do G:=f/[a^2,b^k,(a*b)^3]; od;
> 
> Otherwise GAP can not parse it properly. 
> 
> 
> That is, the syntax of the 'for' loop is
> 
> 	for simple-var in list-expr do statements od;
> 
> so list-expr must be separated from 'in' and 'do'
> 
> 
> Hope this helps,
> Alexander
> 
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum




More information about the Forum mailing list