clean slate



On Thu, 7 May 2009, Leo Butler wrote
 (  in thread Re: [Maxima] Allroot function problem ) :
------------------------------------------------------
Thanks, I should have written `reset(); kill(all);' to achieve an
approximately clean slate.
Leo
-------------------------------------------------
The use of reset( )$ will change the values
of maxima_userdir, maxima_tempdir, and
file_search_maxima to the default values, overriding
values set in your maxima-init.mac startup file.


My current solution to a " clean slate " is to define a function
mstate( ) which prints out functions, values, arrays, facts(),
myoptions, labels, and the value of fpprintprec,
 and a function mkill( ) (see below) which produces
a "clean slate" except for these two functions.

Both of these functions are defined in the file  mstate.mac,
which is loaded at startup via maxima-init.mac. Then I can
invoke mstate( )$ anytime to review the  "current state"
of Maxima, and use mkill( )$ to produce a "clean slate"
 which still has the two functions remaining.

Here is my file mstate.mac:
------------------------------------------
/* file mstate.mac */

disp("  mkill( ),  mstate( ) " )$

mstate( ) :=
  block(
    print("  functions = ", functions),
    print("  values = ", values),
    print("  arrays = ", arrays),
    print("  facts( ) = ", facts( ) ),
    print("  myoptions = ", myoptions),
    print("  labels = ", labels),
    print("  fpprintprec = ", fpprintprec ) )$

mkill() := ( kill ( all ), fpprintprec : 0,
                 load (mstate), print (" clean start"))$
-----------------------------------------
Here is my maxima-init.mac startup file :

maxima_userdir: "c:/work2" $

maxima_tempdir : "c:/work2"$

file_search_maxima :
    append ( ["c:/work2/###.{mac,mc}"], file_search_maxima  )$

load(mstate)$

disp("hello  ted")$

---------------------------------------

Here is an example of startup, and
 use of mstate( ) and  mkill( ) :
-------------------------------------------
Maxima 5.18.1 http://maxima.sourceforge.net
Using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (aka GCL)

(%i1) mstate( )$
  functions =  [mstate( ), mkill( )]
  values =  [ ]
  arrays =  [ ]
  facts() =  [ ]
  myoptions =  [maxima_userdir, maxima_tempdir, file_search_maxima]
  labels =  [%i1]
  fpprintprec =  0

(%i2) maxima_userdir;
(%o2)                              c:/work2

(%i3) load ( qfft );
(%o3)                          c:/work2/qfft.mac

(%i4) mstate( )$

  functions =  [mstate( ), mkill( ), qfft_syntax( ), chop_syntax( ),
    current_small( ), setsmall(val), _chop%(ex), fchop(expr),
    fchop1(expr, small),  nyquist(ns, fs),
    sample(expr, var, ns, dvar), vf(flist, dvar),
     sample_plot(expr, var, vmax, ymin, ymax, flist, dvar, psize),
    sample_plot_eps(expr, var, vmax, ymin, ymax, flist, dvar, psize, fname),
    _fabs%(e), pwr_of_2(ns), qfft(flist), qift(glist), kg(glist),
    flines(flist, nlw, ymax, [klim]),
    glines(glist, nlw, ymax, [klim]),
    glines_eps(glist, nlw, fld, ymax, fname, [klim]),
    flines_eps(flist, nlw, fld, ymax, fname, [klim]),
     kgpoints(kglist, psize, ymax, [klim]),
     kgpoints_eps(kglist, psize, ymax, fname, [klim]), kg_np(glist),
     _sshort%(mysum), _lshort%(alist), short ( expr ),
       browse( [v] ), nonzero(alist),  absmax(alist), maglist(alist, 
numlist)]

  values =  [_small%]

  arrays =  []

  facts() =  []

  myoptions =  [maxima_userdir, maxima_tempdir, file_search_maxima,
                                                                  fpprintprec]

   labels =  [%i4, %o3, %i3, %o2, %i2, %o1, %i1]

  fpprintprec =  5

(%i5) mkill( )$
                               mkill(),  mstate()

 clean start

(%i1) mstate()$

  functions =  [mstate( ), mkill ( )]
  values =  [ ]
  arrays =  [ ]
  facts( ) =  [ ]
  myoptions =  [maxima_userdir, maxima_tempdir, file_search_maxima,
                                                                  fpprintprec]
  labels =  [%i1, %o0]
  fpprintprec =  0

--------------------------------------
Note that the assignment:  fpprintprec : 5$  appears as a
binding in qfft.mac (ch. 11 fast fourier transform
package) and kill(all) does not restore the default
value of fpprintprec. (Is there some other way?)

Ted Woollett
-------------------------------------