Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4761

Re: Quit versus Clear["Global`*"]

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Quit versus Clear["Global`*"]
Date 2011-09-05 11:22 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j42be3$rtv$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 9/4/11 at 6:06 PM, tmatsoukas@me.com (Themis Matsoukas) wrote:

>So, if I use ClearAll["Global`*"] at the beginning of a notebook and
>execute all the cells, is it the same as running on a fresh kernel?

No. This will not reset the evaluation history. Nor will it
remove any packages you may have loaded That is:

In[1]:= x = 4

Out[1]= 4

In[2]:= y = x^2

Out[2]= 16

In[3]:= ClearAll["Global`*"]

In[4]:= %1 + %2

Out[4]= 20

The closest way I know of to reset things to the initial start
up condition is to put a directive to load the CleanSlate
package into init.m. Then after a series of evaluations you can do

CleanSlate[]

which resets things to the point where the CleanSlate package
was loaded.

The last three lines of my init.m are:

<<PacletManager`;
<<Utilities`CleanSlate`;
SetOptions[CleanSlate,Verbose->False];

I explicitly load the PacletManager since I found in earlier
versions of Mathematica, the PackletManager was loading after
everything in init.m executed. I have not tested ver 8 to see if
this is still true. Assuming it is still true, if the
PackletManager is not loaded explicitly in this manner it will
be removed when CleanSlate[] is executed.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Quit versus Clear["Global`*"] Bill Rowe <readnews@sbcglobal.net> - 2011-09-05 11:22 +0000

csiph-web