Re: Quit versus Clear["Global`*"]
- To: mathgroup at smc.vnet.net
- Subject: [mg121299] Re: Quit versus Clear["Global`*"]
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 8 Sep 2011 05:26:10 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On 9/7/11 at 5:42 AM, Kevin.McCann at 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