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


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

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

Started byBill Rowe <readnews@sbcglobal.net>
First post2011-09-08 09:27 +0000
Last post2011-09-08 09:27 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

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

#4827 — Re: Quit versus Clear["Global`*"]

FromBill Rowe <readnews@sbcglobal.net>
Date2011-09-08 09:27 +0000
SubjectRe: Quit versus Clear["Global`*"]
Message-ID<j4a1q7$41o$1@smc.vnet.net>
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


[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web