Top
Back: tab
Forward: pause
FastBack: general_lib
FastForward: poly_lib
Up: inout_lib
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: Index
About: About this document

D.2.3.9 writelist

Procedure from library inout.lib (see inout_lib).

Usage:
writelist(file,name,L); file,name strings (file-name, list-name), L a list.

Create:
a file with name `file`, write the content of the list L into it and call the list `name`, keeping the list structure

Return:
no return value

Note:
The syntax of writelist uses and is similar to the syntax of the write command of Singular which does not manage lists properly. If (file,name) = ("listfile","L1"), writelist creates (resp. appends if listfile exists) a file with name listfile and stores there the list L under the name L1. The Singular command execute(read("listfile")); assigns the content of L (stored in listfile) to a list L1.
On a UNIX system, write(">file",...) overwrites an existing file `file` while write("file",...) and write(">>file",...) append.

Example:
 
LIB "inout.lib";
ring r;
ideal i=x,y,z;
list k="Hi",nameof(basering),i,37;
writelist("zumSpass","lustig",k);
read("zumSpass");
==> list lustig;
==>    lustig[1]=
==> Hi;
==>    lustig[2]=
==> r;
==>    lustig[3]=
==> x,y,z;
==>    lustig[4]=
==> 37;
==> 
list L=res(i,0);                    //resolution of the ideal i
writelist("res_list","res-name",L); "";
==> 
read("res_list");
==> list res-name;
==>    res-name[1]=
==> z,y,x;
==>    res-name[2]=
==> -y*gen(1)+z*gen(2),-x*gen(1)+z*gen(3),-x*gen(2)+y*gen(3);
==>    res-name[3]=
==> x*gen(1)-y*gen(2)+z*gen(3);
==> 
// execute(read("res_list")); would create a list with name res-name,
// which is the resolution of i (the same content as L)
system("sh","/bin/rm res_list zumSpass");
==> 0
// Under UNIX, this removes the files 'res_list' and 'zumSpass'
// Type help system; to get more information about the shell escape
// If your operating system does not accept the shell escape, you
// must remove the just created files 'zumSpass' and 'res_list' directly


Top Back: tab Forward: pause FastBack: general_lib FastForward: poly_lib Up: inout_lib Top: Singular 2-0-4 Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 2-0-4, May 2003, generated by texi2html.