Dear Neha and Forum:

First, it helps to know the following things:
 - what version of GAP you are using
 - what system you are using to run GAP
 - what version of that system are you using

On Jul 7, 2009, at 17:35 , Neha Gupta wrote:

I have written a simple GAP file saved as saved at
"Users/neha/Documents/gap4r4/bin/test1.g " as follows:

local a;
a:=1;;
a:=a*10;
return a*a-8;

The GAP package precisely is saved at the same location. At the GAP terminal
when I type the following command :

gap>Read("./test1.g")();    OR

gap> Read("/test1.g")();   OR

gap> Read("test1.g")();   OR

gap> ReadAsFunction("./test1.g")() ;

the following error is produced for the first three commands :

*Error, file "./test1.g" must exist and be readable called from
<function>( <arguments> ) called from read-eval-loop*.

I would guess from this error message that the file does not exist where you think it does. Each process (like the GAP program) has associated with it a directory, which is used when you give a name like "./foo" or "foo", to locate the file (i.e., GAP assumes that these file names reside in that associated directory).

First, try using the full file name.

and the following error is produced for the last command :

*<func> must be a function (not a boolean)*

I can't explain this one, but perhaps it is a quirk of the implementation, dealing with a non-existent file in an odd way (I can't duplicate this exact behavior on my system [GAP 4.4.12])

However, at least in the version of GAP I am using, ReadAsFunction() is a function, returning as its value a handle on the function created by executing the above.

On my system, I get this:

gap> a := 1;
1
gap> g:=ReadAsFunction("/tmp/x.g");
function(  ) ... end
gap> g();
92
gap> a;
1

I hope this provides some help.

Regards,

Justin

--
Justin C. Walker
Curmudgeon-at-large
Director
Institute for the Absorption of Federal Funds
----
186,000 Miles per Second
Not just a good idea:
  it's the law!
----

_______________________________________________
Forum mailing list
[email protected]
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to