[GAP Forum] Lists in GAP

Benjamin Sambale bsambale at gmx.de
Wed Jul 1 12:59:54 BST 2009


Dear Neha,

maybe you have to initialize your list first. Just put a elems2:=[]; in 
front of the loop and try.

Best wishes,
Benjamin

Neha Gupta schrieb:
> Dear Forum Member,
>
> I want to use arrays in GAP. But Im not able to find a way of
> declaring/defining one.  The following is what I intend to do...
>
> I have defined elems1 as a List with 36 members. A tyical element of elems1
> looks like this :
>         Tuple([ C2[1],Random(M)])
>
> Now I wish to define another List elems2 also with 36 members using elems1 :
>
> b:=Random([1..16]);;
> x:=elems1[b][2];;
> pik:=Random(M);;
>
> for j in  [1..36]  do
>     if (j<> b) then
>         elems2[j]:=elems1[j];;
>     else
>         elems2[j]:=Tuple([elems1[j][1],pik]);;
>      fi;
> od;
>
> I get the following error :
>
> " Error, The list you are trying to assign to is immutable called from
> j <> b called from
> <function>( <arguments> ) called from read-eval-loop "
>
> Please help me defining a List/Array.
>
> Neha
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>
>   



More information about the Forum mailing list