Dear Forum,
I don't understand why the following does not work.
(Gap 3.4 on a Sun under SunOS or a PC under Linux 2.0).
gap> tt:=function(infile) > local A; > Read(infile); > return A; > end; gap> Read("c"); gap> A; 10 gap> gap> tt("c"); Error, Variable: 'A' must have a value at return A ... in tt( "c" ) called from main loop brk> brk> return; gap> Read("c"); gap> A; 10 gap>
I don't see why A:=10 is not executed inside the function.
Or, rather, why the evaluation of A is somehow delayed (?)
I tried to change Read into READ and see if it reports "true" - it does...
the file "c" is as follows (just one line). #-------------------------- A:=10;; #---------------
Many thanks in advance,
Dima
PS. This happened when I tried to Exec something producing a
GAP-readable file and then Read it there, all within a function.
What would be the alternative to what I'm trying to do?
Dmitrii V. Pasechnik
Department of Mathematics
Eindhoven University of Technology
PO Box 513, 5600 MB Eindhoven
The Netherlands
e-mail: dima@win.tue.nl
http://www.can.nl/~pasec