MathGroup Archive 1995

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

Search the Archive

Re: Clearing functions and variables


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.



  • Prev by Date: natural log of E
  • Next by Date: Re: Advice on "MMA for Scientists and Engineers" Book
  • Previous by thread: Re: Clearing functions and variables
  • Next by thread: simplify