[GAP Forum] Create a list of functions in GAP
Le Van Luyen
lvluyen at gmail.com
Wed Sep 11 16:21:45 BST 2013
Dear all,
I want to create a list of functions in GAP and I have used the following
code lines:
gap> F:=[];
gap> for i in [1..5] do
> F[i]:=function( n)
> return n+i;
> end;
> od;
I expect the result will be: F[1](1)=2; F[2](1)=3; F[3](1)=4
But, In GAP
gap>F[1](1);
6
gap>F[2](1);
6
gap>F[3](1);
6
It looks like all functions of list A are the same.
Could you give me a way to create a list of functions like that?
Thank you very much.
Bests,
Luyen
More information about the Forum
mailing list