MathGroup Archive 2011

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

Search the Archive

Re: Quit versus Clear["Global`*"]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121257] Re: Quit versus Clear["Global`*"]
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 6 Sep 2011 03:58:07 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201109042206.SAA21533@smc.vnet.net> <j42b3a$rrv$1@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

OK, putting it in a separate cell didn't help, but if you Quit while  
evaluating initialization cells... you'll stop evaluating them. (Not so  
surprising, really.)

So instead of Quit, add Clear and ClearAll for everything that needs it.  
In the code of your example, there's nothing that needs it.

Whenever I define a function that could EVER need Clear, I precede that  
definition with Clear. To start all over, I can go to the menus and select  
Evaluate>Evaluate Initialization Cells. When in doubt, I quit the kernel  
with Evaluation>Quit Kernel, particularly if evaluating code is in an  
infinite (or very long?) loop.

spell and spell1 are Off by default at my machine, by the way. I'm not  
sure what that would be so here, but not at your machine. I used to have  
to turn them off manually, but that was a long time ago.

Bobby

On Mon, 05 Sep 2011 15:00:46 -0500, Kevin J. McCann <kjm at kevinmccann.com>  
wrote:

> I have to wait for Quit to finish executing, and then execute the rest.
>
> On 9/5/2011 1:40 PM, DrMajorBob wrote:
>> Put Quit in a cell by itself.
>>
>> Bobby
>>
>> On Mon, 05 Sep 2011 07:15:08 -0500, Kevin J. McCann  
>> <kjm at kevinmccann.com> wrote:
>>
>>> This is a related observation to the use of Quit.
>>>
>>> I have an initialization cell at the top of most of my notebooks that  
>>> loads my favorite packages and sets options. If I put Quit at the top  
>>> of all that, and then execute the whole section, the Quit seems to  
>>> override everything, i.e. at the end nothing is defined.
>>>
>>> It appears that while Quit is executing, the other commands do, but  
>>> then the Quit kills off the results. I am not explaining it well, so  
>>> here is some abbreviated code from one of my nb's. Dump it all into an  
>>> Input cell and execute. At the end you will see that x is not defined.
>>>
>>> Kevin
>>>
>>> Quit
>>> Off[General::spell];
>>> Off[General::spell1];
>>> bs = {FontFamily -> "Arial", FontSize -> 14, FontWeight -> Bold};
>>> SetOptions[Plot,
>>>        Frame -> True,
>>>        FrameStyle -> AbsoluteThickness[2],
>>>        GridLines -> Automatic,
>>>        PlotStyle -> {{Red, AbsoluteThickness[3]}, {Black,
>>>       AbsoluteThickness[3]}, {Blue,
>>>       AbsoluteThickness[3]}, {Darker@Green, AbsoluteThickness[3]}},
>>>    BaseStyle -> bs
>>>    ];
>>> SetOptions[ListPlot,
>>>        Frame -> True,
>>>        FrameStyle -> AbsoluteThickness[2],
>>>        GridLines -> Automatic,
>>>        PlotStyle -> {Blue, AbsolutePointSize[2]},
>>>    BaseStyle -> bs
>>>    ];
>>> $Post := (If[MatrixQ[#], MatrixForm[#], #] &)
>>> x = 22/7.;
>>>
>>> On 9/5/2011 7:16 AM, DrMajorBob wrote:
>>>> No. For that, you need:
>>>>
>>>> Quit
>>>>
>>>> Bobby
>>>>
>>>> On Sun, 04 Sep 2011 17:06:32 -0500, Themis  
>>>> Matsoukas<tmatsoukas at me.com>
>>>> wrote:
>>>>
>>>>> So, if I use ClearAll["Global`*"] at the beginning of a notebook and
>>>>> execute all the cells, is it the same as running on a fresh kernel?
>>>>>
>>>>> Themis
>>>>>
>>>>
>>>>
>>
>>


-- 
DrMajorBob at yahoo.com




  • Prev by Date: Re: Quit versus Clear["Global`*"]
  • Next by Date: Re: Preprocessing file input
  • Previous by thread: Re: Quit versus Clear["Global`*"]
  • Next by thread: Re: Quit versus Clear["Global`*"]