Dear Forum,
Please, explain to me why the following function does not work:
-------------------------------
F:=function(a)
local b;
Read(InputTextString("b:=a;"));
return b;
end;
-------------------------------
I expected that, for example, F(1) would equal 1.
However, GAP returns an error:
----------------------------------------------------
gap> F(1);
Variable: 'a' must have a value
Variable: 'b' must have an assigned value at
return b;
called from
<function>( <arguments> ) called from read-eval-loop
Entering break read-eval-print loop ...
you can 'quit;' to quit to outer loop, or
you can 'return;' after assigning a value to continue
-----------------------------------------------------
The code does work in the main read-eval-print loop, though:
------------------------------------
gap> a:=1;
1
gap> Read(InputTextString("b:=a;"));
gap> b;
1
------------------------------------
Thank you,
Anvita
_______________________________________________
Forum mailing list
[email protected]
http://mail.gap-system.org/mailman/listinfo/forum