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

Alexander Konovalov alexander.konovalov at gmail.com
Wed Dec 7 20:25:24 GMT 2011


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



More information about the Forum mailing list