MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at
  • Subject: [mg121299] Re: Quit versus Clear["Global`*"]
  • From: Bill Rowe <readnews at>
  • Date: Thu, 8 Sep 2011 05:26:10 -0400 (EDT)
  • Delivered-to:

On 9/7/11 at 5:42 AM, Kevin.McCann at (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:


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


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

  • Prev by Date: Re: two coupled differential equations
  • Next by Date: Alignment problem with Row[ ]
  • Previous by thread: Re: Quit versus Clear["Global`*"]
  • Next by thread: two coupled differential equations