[GAP Forum] A command

Robert Morse rm43 at evansville.edu
Fri Sep 2 19:04:16 BST 2016


Dear Sara,

You are using the elements in L as indices into the list M.  Just Add
the values to M:

gap> L:=[2,23,10,15];;
gap> M:=[];;

gap> for i in L do
> Add(M,QuoInt(465372-Sum(L),i)+3);
> od;
gap> M;
[ 232664, 20234, 46535, 31024 ]


Robert F. Morse


On Fri, Sep 2, 2016 at 12:32 PM, Sara Dikson <s.dikson2016 at gmail.com> wrote:
> Dear Forum
> I use "QuoInt" command for elements of a list.
> Gap returns me a list with some empty spaces like following example:
>
> gap> L:=[2,23,10,15];
>
> [ 2, 23, 10, 15 ]
>
> gap> M:=[];;
>
> gap> for i in L do
>
>> M[i]:=QuoInt(465372-Sum(L),i)+3;
>
>> od; M;
>
> [ , 232664,,,,,,,, 46535,,,,, 31024,,,,,,,, 20234 ]
>
> Although I can compact M by "Compacted(M)", I want a command for "for" loop
> which does not create any empty spaces. Is it possible?
>
> I mean I need such a command that calculate ''QuoInt'' for five elements of
> list "L" and no more.
>
> I need it because I think  the empty spaces for a list with large
> integer takes up a lot of memory.
>
>
> Best regards
>
> Sara
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum



More information about the Forum mailing list