Changeset a25fbca in git for Singular/LIB/inout.lib


Ignore:
Timestamp:
Feb 9, 2010, 7:34:44 PM (14 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
bf3a67ebcb83abf41b02b083b19bd29eb4000fe6
Parents:
6c939eebfd221f2512b1e27d158d1b5457206987
Message:
removed inout::writelist

git-svn-id: file:///usr/local/Singular/svn/trunk@12541 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/inout.lib

    r6c939e ra25fbca  
    1515 split(string,n);       split given string into lines of length n
    1616 tab(n);                string of n space tabs
    17  writelist(...);        write a list into a file and keep the list structure
    1817 pause([prompt]);       stop the computation until user input
    1918           (parameters in square brackets [] are optional)
     
    665664///////////////////////////////////////////////////////////////////////////////
    666665
    667 proc writelist (string fil, string nam, list L)
    668 "USAGE:   writelist(file,name,L);  file,name strings (file-name, list-name),
    669           L a list.
    670 CREATE:  a file with name `file`, write the content of the list L into it and
    671          call the list `name`, keeping the list structure
    672 RETURN:  no return value
    673 NOTE:    The syntax of writelist is similar to the syntax of the
    674          write command of @sc{Singular} which does not manage lists properly.
    675          If (file,name) = (\"listfile\",\"L1\"),  writelist creates (resp.
    676          appends if listfile exists) a file with name listfile and stores
    677          there the list L under the name L1. The @sc{Singular} command
    678          @code{execute(read(\"listfile\"))}; assigns the content of L (stored in
    679          listfile) to a list L1.
    680 @*       On a UNIX system, write(\">file\",...) overwrites an existing file
    681          `file` while write(\"file\",...) and write(\">>file\",...) append.
    682 EXAMPLE: example writelist; shows an example
    683 "
    684 {
    685    int i;
    686    write(fil,"list "+nam+";");
    687    if( fil[1]==">" ) { fil=fil[2..size(fil)]; }
    688    if( fil[1]==">" ) { fil=fil[2..size(fil)]; }
    689     for( i=1;i<=size(L);i=i+1 )
    690     {
    691       if (typeof(L[i]) == "intmat")
    692       {
    693         write(fil,"   "+nam+"["+string(i)+"]="+
    694         "intmat(intvec("+string(L[i])+
    695         "),"+string(nrows(L[i]))+","+string(ncols(L[i]))+");");
    696       }
    697       else
    698       {
    699         if ( typeof(L[i])== "matrix")
    700         {
    701           write(fil,"   "+nam+"["+string(i)+"]="+
    702           "matrix(ideal("+string(L[i])+
    703           "),"+string(nrows(L[i]))+","+string(ncols(L[i]))+");");
    704         }
    705         else
    706         {
    707           write(fil,"   "+nam+"["+string(i)+"]="+typeof(L[i])+"(",string(L[i])+");");
    708         }
    709       }
    710     }
    711    return();
    712 }
    713 example
    714 {  "EXAMPLE:"; echo = 2;
    715    ring r;
    716    ideal i=x,y,z;
    717    list k="Hi",nameof(basering),i,37;
    718    writelist("zumSpass","lustig",k);
    719    read("zumSpass");
    720    list L=res(i,0);                    //resolution of the ideal i
    721    writelist("res_list","res-name",L); "";
    722    read("res_list");
    723    // execute(read("res_list")); would create a list with name res-name,
    724    // which is the resolution of i (the same content as L)
    725 
    726    system("sh","/bin/rm res_list zumSpass");
    727    // Under UNIX, this removes the files 'res_list' and 'zumSpass'
    728    // Type help system; to get more information about the shell escape
    729    // If your operating system does not accept the shell escape, you
    730    // must remove the just created files 'zumSpass' and 'res_list' directly
    731 }
    732 ///////////////////////////////////////////////////////////////////////////////
    733 
    734666proc pause(list #)
    735667"USAGE:    pause([ prompt ])  prompt string
Note: See TracChangeset for help on using the changeset viewer.