> < ^ Date: Tue, 26 Nov 1996 23:13:43 +0100
> < ^ From: Dmitrii Pasechnik <d.pasechnik@twi.tudelft.nl >
^ Subject: Read in a function.

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;
gap> tt("c");
Error, Variable: 'A' must have a value at
return A ... in
tt( "c" ) called from
main loop
brk> return;
gap> Read("c");
gap> A;

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).

Many thanks in advance,

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

> < [top]