Home Online Manual
Top
Back: kmemory
Forward: number_e
FastBack: compregb_lib
FastForward: grobcov_lib
Up: general_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.2.3.9 killall

Procedure from library general.lib (see general_lib).

Usage:
killall(); (no parameter)
killall("type_name");
killall("not", "type_name");

Return:
killall(); kills all user-defined variables except loaded procedures, no return value.
- killall("type_name"); kills all user-defined variables, of type "type_name"
- killall("not", "type_name"); kills all user-defined variables, except those of type "type_name" and except loaded procedures
- killall("not", "name_1", "name_2", ...); kills all user-defined variables, except those of name "name_i" and except loaded procedures

Note:
killall should never be used inside a procedure

Example:
 
LIB "general.lib";
ring rtest; ideal i=x,y,z; string str="hi"; int j = 3;
export rtest,i,str,j;       //this makes the local variables global
==> // ** `rtest` is already global
==> // ** `i` is already global
==> // ** `str` is already global
==> // ** `j` is already global
listvar();
==> // j                              [0]  int 3
==> // str                            [0]  string hi
==> // rtest                          [0]  *ring
==> //      i                              [0]  ideal, 3 generator(s)
killall("ring");            // kills all rings
==> // ** killing the basering for level 0
listvar();
==> // j                              [0]  int 3
==> // str                            [0]  string hi
killall("not", "int");      // kills all variables except int's (and procs)
listvar();
==> // j                              [0]  int 3
==> // str                            [0]  string hi
killall();                  // kills all vars except loaded procs
listvar();
==> // j                              [0]  int 3