MathGroup Archive 1995

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

Search the Archive

Re: Clearing functions and variables

  • To: mathgroup at
  • Subject: [mg1994] Re: Clearing functions and variables
  • From: Scott.A.Hill at (Lancelot)
  • Date: Wed, 6 Sep 1995 23:50:20 -0400
  • Organization: Williams College, Williamstown MA

In article <DEEtnC.DHL at>,
Michael A. Rutter <rutter at> 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

	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

AllClear[]:= (
	confirm =
	StringTake[InputString["Confirm clear by typing 'y'"],1]=="y";
	If[confirm, (ClearAll["Global`*"];Remove["Global`*"]),Null]);

You can omit the prompt if you want, of course, like so:

AllClear[]:=(ClearAll["Global`*"]; Remove["Global`*"]);

:@-) 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