[GAP Forum] Lists in GAP

Neha Gupta neha.gupta2008 at googlemail.com
Tue Jul 7 13:28:18 BST 2009


Dear GAP Members,

I have written the following code using while loop :

while loop_value[i]<>loop_value[i-1]  do
    loop_elems:=optimal(181);;
    loop_value[i]:=value;;
    First_elems:=loop_elems;;
    First_value:=loop_value[i];;
    i:=i+1;;
od;


Here, 'loop_value' and 'loop_elems' are a list. The while loop is supposed
to run until any two consecutive places in list have the same value. The
function 'optimal' returns a list. We assign this list to the list
'loop_elems'. There is also a global variable 'value' which is used in the
the function 'optimal'. We assign this variable to 'loop_value[i]'.

But the program generates the following error at the run time :

*List Element: <list>[37] must have an assigned value at
while loop_value[i] <> loop_value[i - 1]  do
    loop_elems := optimal( 181 );
    ;
    loop_value[i] := value;
    ;
    First_elems := loop_elems;
    ;
    First_value := loop_value[i];
    ;
    i := i + 1;
    ;
od;
 called from
<function>( <arguments> ) called from read-eval-loop

*Does the error mean that the list 'loop_value[]' can not have more than 36
places as a list ???
Please help as I do not understand this run time error.


Thanks

Best
Neha Gupta


More information about the Forum mailing list