Re: ClearAll ?? or what
- To: mathgroup at smc.vnet.net
- Subject: [mg102825] Re: ClearAll ?? or what
- From: AES <siegman at stanford.edu>
- Date: Fri, 28 Aug 2009 00:46:40 -0400 (EDT)
- Organization: Stanford University
- References: <h7371j$b28$1@smc.vnet.net> <h75nba$p3g$1@smc.vnet.net>
In article <h75nba$p3g$1 at smc.vnet.net>,
Armand Tamzarian <mike.honeychurch at gmail.com> wrote:
> Remove["Global'*"]
> or
> If[Length[Names["Global`*"]] > 0, Remove["Global`*"]];
> so as to avoid the message of no Global symbols exist.
The point here is that you might routinely put
Remove["Global'*"]
as the first line in all of your freestanding notebooks, so that any
time you open a new notebook or edit something in an existing notebook,
then do a Select All and Enter to execute that notebook, you will have
something like a "clean start" for that execution.
The problem (a minor one) is that if you do this, then the first time
you execute such a notebook in a newly opened Mathematica session, you
will get the "error" message:
Remove::rmnsm: There are no symbols matching "Global`*". >>
I put "error" in quotes here because (a) so far as I can see you haven't
really damaged anything by doing this, and (b) this shouldn't be called
an error in any case, at least if you live by the standard computer
science wildcard convention that "the asterisk character ("*")
substitutes for any zero or more characters".
The history is that doing this wasn't an error through several early
versions of Mathematica. It became an error sometime around v4?
or v5?. Why? -- who knows?
The solution, so far as I can see, is to use
x; Remove["Global'*"]
as the first line in all your notebooks. Can this do any harm?