[GAP Forum] Lists in GAP

Joe Bohanon jbohanon2 at gmail.com
Tue Jul 7 15:22:08 BST 2009


It means that there is nothing stored in loop_value[37], that's all. 

Test this out on your list by calling IsBound(loop_value[37]).

If you want to see what is happening just before you get the error, just 
after the "while" add "i<>37 or"

It should stop there and you can see what GAP is using for loop_value.

Joe

Neha Gupta wrote:
> 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
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>
>   



More information about the Forum mailing list