Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4756 > unrolled thread

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

Started byDrMajorBob <btreat1@austin.rr.com>
First post2011-09-05 11:16 +0000
Last post2011-09-08 09:30 +0000
Articles 8 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Quit versus Clear["Global`*"] DrMajorBob <btreat1@austin.rr.com> - 2011-09-05 11:16 +0000
    Re: Quit versus Clear["Global`*"] DrMajorBob <btreat1@austin.rr.com> - 2011-09-06 08:04 +0000
      Re: Quit versus Clear["Global`*"] "Kevin J. McCann" <Kevin.McCann@umbc.edu> - 2011-09-07 09:50 +0000
    Re: Quit versus Clear["Global`*"] "Kevin J. McCann" <kjm@KevinMcCann.com> - 2011-09-06 08:07 +0000
    Re: Quit versus Clear["Global`*"] "Kevin J. McCann" <kjm@KevinMcCann.com> - 2011-09-07 09:44 +0000
    Re: Quit versus Clear["Global`*"] DrMajorBob <btreat1@austin.rr.com> - 2011-09-07 09:41 +0000
      Re: Quit versus Clear["Global`*"] "Kevin J. McCann" <Kevin.McCann@umbc.edu> - 2011-09-07 12:30 +0000
    Re: Quit versus Clear["Global`*"] DrMajorBob <btreat1@austin.rr.com> - 2011-09-08 09:30 +0000

#4756 — Re: Quit versus Clear["Global`*"]

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-09-05 11:16 +0000
SubjectRe: Quit versus Clear["Global`*"]
Message-ID<j42b3a$rrv$1@smc.vnet.net>
No. For that, you need:

Quit

Bobby

On Sun, 04 Sep 2011 17:06:32 -0500, Themis Matsoukas <tmatsoukas@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@yahoo.com

[toc] | [next] | [standalone]


#4785

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-09-06 08:04 +0000
Message-ID<j44k71$94u$1@smc.vnet.net>
In reply to#4756
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@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@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@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@yahoo.com

[toc] | [prev] | [next] | [standalone]


#4820

From"Kevin J. McCann" <Kevin.McCann@umbc.edu>
Date2011-09-07 09:50 +0000
Message-ID<j47eon$l70$1@smc.vnet.net>
In reply to#4785
Actually the code was just an example. I teach a class in Mathematica, 
and I would like the students to put a Quit at the top of each homework 
they turn in; so, then I can just select all and execute. The Quit 
would, of course, wipe out all previously defined things, so we start 
with a clean slate. Apparently, though, this won't work for the 
aforementioned reasons.

Kevin

On 9/6/2011 4:04 AM, DrMajorBob wrote:
> 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@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@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@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
>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>

[toc] | [prev] | [next] | [standalone]


#4791

From"Kevin J. McCann" <kjm@KevinMcCann.com>
Date2011-09-06 08:07 +0000
Message-ID<j44kcp$96n$1@smc.vnet.net>
In reply to#4756
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@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
>>
>
>

[toc] | [prev] | [next] | [standalone]


#4803

From"Kevin J. McCann" <kjm@KevinMcCann.com>
Date2011-09-07 09:44 +0000
Message-ID<j47ee6$l43$1@smc.vnet.net>
In reply to#4756
I guess the point here is that when commands are listed sequentially, at 
least with Quit at the top, they are not carried out that way, but 
perhaps in some parallel fashion. This is not documented anywhere, and I 
don't think it is expected behavior. Further, I think it is not desirable.

Kevin

On 9/5/2011 4:23 PM, DrMajorBob wrote:
> 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@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@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@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
>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>

[toc] | [prev] | [next] | [standalone]


#4814

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-09-07 09:41 +0000
Message-ID<j47e8e$l24$1@smc.vnet.net>
In reply to#4756
No, the point is that when Quit is the first command, the kernel quits...  
rather than continuing to evaluate initialization cells. That appears  
entirely sequential, to me.

Bobby

On Tue, 06 Sep 2011 05:13:30 -0500, Kevin J. McCann <kjm@kevinmccann.com>  
wrote:

> I guess the point here is that when commands are listed sequentially, at  
> least with Quit at the top, they are not carried out that way, but  
> perhaps in some parallel fashion. This is not documented anywhere, and I  
> don't think it is expected behavior. Further, I think it is not  
> desirable.
>
> Kevin
>
> On 9/5/2011 4:23 PM, DrMajorBob wrote:
>> 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@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@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@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@yahoo.com

[toc] | [prev] | [next] | [standalone]


#4823

From"Kevin J. McCann" <Kevin.McCann@umbc.edu>
Date2011-09-07 12:30 +0000
Message-ID<j47o5g$mva$1@smc.vnet.net>
In reply to#4814
But then shouldn't the kernel restart on the next line? If not, then 
when would the kernel restart? Never? After we wait a few seconds?

Quit (* the kernel quits *)
x=1; (* shouldn't the kernel restart here? *)

Actually, it appears that Quit takes some time to execute, and in 
parallel, further commands execute, but then their results are killed off.

Kevin

On 9/7/2011 5:41 AM, DrMajorBob wrote:
> No, the point is that when Quit is the first command, the kernel quits...
> rather than continuing to evaluate initialization cells. That appears
> entirely sequential, to me.
>
> Bobby
>
> On Tue, 06 Sep 2011 05:13:30 -0500, Kevin J. McCann<kjm@kevinmccann.com>
> wrote:
>
>> I guess the point here is that when commands are listed sequentially, at
>> least with Quit at the top, they are not carried out that way, but
>> perhaps in some parallel fashion. This is not documented anywhere, and I
>> don't think it is expected behavior. Further, I think it is not
>> desirable.
>>
>> Kevin
>>
>> On 9/5/2011 4:23 PM, DrMajorBob wrote:
>>> 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@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@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@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
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>

[toc] | [prev] | [next] | [standalone]


#4832

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-09-08 09:30 +0000
Message-ID<j4a1v1$436$1@smc.vnet.net>
In reply to#4756
I don't think anything is happening in parallel; it takes TWO or more  
kernels for that.

Bobby

On Wed, 07 Sep 2011 07:29:35 -0500, Kevin J. McCann  
<Kevin.McCann@umbc.edu> wrote:

> But then shouldn't the kernel restart on the next line? If not, then
> when would the kernel restart? Never? After we wait a few seconds?
>
> Quit (* the kernel quits *)
> x=1; (* shouldn't the kernel restart here? *)
>
> Actually, it appears that Quit takes some time to execute, and in
> parallel, further commands execute, but then their results are killed  
> off.
>
> Kevin
>
> On 9/7/2011 5:41 AM, DrMajorBob wrote:
>> No, the point is that when Quit is the first command, the kernel  
>> quits...
>> rather than continuing to evaluate initialization cells. That appears
>> entirely sequential, to me.
>>
>> Bobby
>>
>> On Tue, 06 Sep 2011 05:13:30 -0500, Kevin J. McCann<kjm@kevinmccann.com>
>> wrote:
>>
>>> I guess the point here is that when commands are listed sequentially,  
>>> at
>>> least with Quit at the top, they are not carried out that way, but
>>> perhaps in some parallel fashion. This is not documented anywhere, and  
>>> I
>>> don't think it is expected behavior. Further, I think it is not
>>> desirable.
>>>
>>> Kevin
>>>
>>> On 9/5/2011 4:23 PM, DrMajorBob wrote:
>>>> 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@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@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@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@yahoo.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web