[GAP Forum] can one define identifiers like f1, f2, f3 in an automatic way?

Luca giuzzi luca.giuzzi at gmail.com
Sun Mar 20 19:39:26 GMT 2011


I do not know if this is the most straightforward (or idiomatic)
 way to do it, but this seems to work as expected:


for i in [1..10] do                       
 str:=Concatenation("f",String(i)," := ",String(i)," ; ");
 istr:=InputTextString(str);
 ReadAsFunction(istr)();
od;

By the way, is there any other way to get something
akin to eval() in gap?

All the best,
 lg


On Sunday, March 20, 2011 05:17:53 pm Igor Korepanov wrote:
> Dear Forum,
> 
> When I worked in Maple, it was possible to define an identifier like   f2 
> in such a way: first write n:=2;
> and then write   f||n .
> 
> That is, concatenate symbols to make an identifier for a variable or a
> function.
> 
> Is something like that possible in GAP ?
> 
> Best wishes,
> 
> Igor
> 
> 
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum


More information about the Forum mailing list