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


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

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-08 09:27 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j4a1q7$41o$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 9/7/11 at 5:42 AM, Kevin.McCann@umbc.edu (Kevin J. McCann) wrote:

>Actually the code was just an example. I teach a class in
>Mathematica, and I would like the students to put a Quit at the top
>of each homework they turn in; so, then I can just select all and
>execute. The Quit would, of course, wipe out all previously defined
>things, so we start with a clean slate. Apparently, though, this
>won't work for the aforementioned reasons.

My method of achieving a clean slate to work with is as follows:

The last lines of my init.m file are as follows:

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

The last line simply sets some options for CleanSlate I like.
The line before obviously loads the CleanSlate package. The
first line intentionally loads the PacletManager before the
CleanSlate package because I found this was loading after
commands in init.m were executing.

With this, simply doing

CleanSlate[];

prior to executing any commands in a notebook clears the Global
context, removes any packages loaded after the CleanSlate
package was loaded and resets the session history. That is, this
restores things to what they were when I first started a
Mathematica session without actually quitting the kernel.

I find this to be a very handy utility which is why I have it
loaded in my init.m file


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-08 09:27 +0000

csiph-web