Reading a script gives error, but directly using the script's content works
Posted: 23 Mar 2017, 12:49
Hi!
I've put the following into a file `test.pmk`:
Then, I tried to read it as a script, which fails:
However, in an interactive session, all works fine:
My question is: What command must I use in order to read the content of a file so that it is interpreted in the same way as in user interaction? I thought the answer is "script", but I may be mistaken.
Cheers,
Simon
I've put the following into a file `test.pmk`:
Code: Select all
@x=([[12, -2, -3, -5, -8, -13, -21, -34, -55], [0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0]]);
Code: Select all
polytope > script "test.pmk";
polymake: ERROR: reference to an undeclared variable @x at /home/king/test.pmk line 1.
Code: Select all
polytope > @x=([[12, -2, -3, -5, -8, -13, -21, -34, -55], [0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0]]);
polytope > print $x[0]->[0][1];
-2
Cheers,
Simon