Re: Clearing functions and variables
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1994] Re: Clearing functions and variables
- From: Scott.A.Hill at williams.edu (Lancelot)
- Date: Wed, 6 Sep 1995 23:50:20 -0400
- Organization: Williams College, Williamstown MA
In article <DEEtnC.DHL at wri.com>, Michael A. Rutter <rutter at euler.mcs.utulsa.edu> wrote: > >Does anybody know a simple command to clear all the variables and functions in >a Mathematica session. We have been using Clear /@ Names["Global`*"], but >since we are teaching a freshman level Calc course, this is difficult to >explain. There is a package called "CleanSlate" which will utterly restore Mathematica to its condition at start-up. But if you don't feel like hunting that down, Clear["Global`*"] should do the trick rather easily. Or define a function such as this at the start of each session: AllClear[]:= ( confirm = StringTake[InputString["Confirm clear by typing 'y'"],1]=="y"; If[confirm, (ClearAll["Global`*"];Remove["Global`*"]),Null]); Protect[AllClear]; You can omit the prompt if you want, of course, like so: AllClear[]:=(ClearAll["Global`*"]; Remove["Global`*"]); Protect[AllClear]; / :@-) Scott \ Unsophisticated, but I get by.