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


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

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

Started byDrMajorBob <btreat1@austin.rr.com>
First post2011-09-06 08:03 +0000
Last post2011-09-08 09:32 +0000
Articles 4 — 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-06 08:03 +0000
    Re: Quit versus Clear["Global`*"] "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-09-07 09:44 +0000
    Re: Quit versus Clear["Global`*"] Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2011-09-07 12:29 +0000
    Re: Quit versus Clear["Global`*"] "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-09-08 09:32 +0000

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

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-09-06 08:03 +0000
SubjectRe: Quit versus Clear["Global`*"]
Message-ID<j44k53$94d$1@smc.vnet.net>
Quit appears to quit as soon as it is parsed, regardless of arguments...  
yet another poster found that, if it is the first line in a cell with  
other statements, Mathematica doesn't quit until those other statements  
are done, hence wiping out their effect.

Quit[e] the conundrum.

Bobby

On Mon, 05 Sep 2011 13:15:07 -0500, Andrzej Kozlowski <akoz@mimuw.edu.pl>  
wrote:

> Well, I see it differently. All Mathematica functions have the form  
> Head[arguments] where the number of arguments could be 0. Quit is  
> therefore a Mathematica function, like Print[], Return[]. In fact,  
> Quit[n] where n is an integer also works "passing the integer n as an  
> exit code to the operating system" whatever that means. On the other  
> hand, expressions of the form Abracadabra are normally just symbols and  
> normally they do not perform any actions. In fact, do you know of any  
> other example (except Quit) when when evaluating a symbols actually does  
> more than return a value (that usually happens in the case of global  
> constants, whose names begin with $,
>
> [1]:= $Version
>
> Out[1]= 8.0 for Mac OS X x86 (64-bit) (February 23, 2011)
>
> Note, by the way, that Abort[] works but Abort does not:
>
> In[3]:= Print[a];Abort[];Print[b]
> During evaluation of In[3]:= a
> Out[3]= $Aborted
>
> Print[a];Abort;Print[b]
> a
> b
>
> Andrzej Kozlowski
>
>
>
>
> On 5 Sep 2011, at 19:44, DrMajorBob wrote:
>
>> I, on the other hand, never saw Quit[] until this thread began.
>>
>> I suppose it figures that if Quit kills the kernel, then also Quit[any  
>> arguments or none] might also kill the kernel. (The other way 'round  
>> doesn't necessarily "figure", on the other hand.)
>>
>> Bobby
>>
>> On Mon, 05 Sep 2011 07:44:17 -0500, Andrzej Kozlowski  
>> <akoz@mimuw.edu.pl> wrote:
>>
>>> Actually (as far as I can tell) Quit is undocumented but Quit[] is:
>>>
>>> ?Quit
>>> Quit[] terminates a Mathematica kernel session.
>>>
>>> I thought you had made a mistake but I tired just Quit (without the  
>>> brackets) and was surprised (after all these years!) to see it work. I  
>>> am wondering if there are more cases like this?
>>>
>>> Andrzej Kozlowski
>>>
>>> On 5 Sep 2011, at 13:06, 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
>>>>
>>>
>>
>>
>> --
>> DrMajorBob@yahoo.com
>


-- 
DrMajorBob@yahoo.com

[toc] | [next] | [standalone]


#4802

From"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Date2011-09-07 09:44 +0000
Message-ID<j47ed7$l3q$1@smc.vnet.net>
In reply to#4783
Quit[Abort[]] doesn't quit; instead it gives $Aborted. (I dare say as  
expected.)

Quit vs. Quit[] performing the same operation isn't a great mystery: one  
can define

f := a

and

f[args___] := a

and get the same result regardless of whether f is called as f or f[...].  
In general DownValues and OwnValues don't work like this, but providing  
for such behaviour in a specific case is easy.

On Tue, 06 Sep 2011 09:03:47 +0100, DrMajorBob <btreat1@austin.rr.com>  
wrote:

> Quit appears to quit as soon as it is parsed, regardless of arguments...
> yet another poster found that, if it is the first line in a cell with
> other statements, Mathematica doesn't quit until those other statements
> are done, hence wiping out their effect.
>
> Quit[e] the conundrum.
>
> Bobby
>
> On Mon, 05 Sep 2011 13:15:07 -0500, Andrzej Kozlowski <akoz@mimuw.edu.pl>
> wrote:
>
>> Well, I see it differently. All Mathematica functions have the form
>> Head[arguments] where the number of arguments could be 0. Quit is
>> therefore a Mathematica function, like Print[], Return[]. In fact,
>> Quit[n] where n is an integer also works "passing the integer n as an
>> exit code to the operating system" whatever that means. On the other
>> hand, expressions of the form Abracadabra are normally just symbols and
>> normally they do not perform any actions. In fact, do you know of any
>> other example (except Quit) when when evaluating a symbols actually does
>> more than return a value (that usually happens in the case of global
>> constants, whose names begin with $,
>>
>> [1]:= $Version
>>
>> Out[1]= 8.0 for Mac OS X x86 (64-bit) (February 23, 2011)
>>
>> Note, by the way, that Abort[] works but Abort does not:
>>
>> In[3]:= Print[a];Abort[];Print[b]
>> During evaluation of In[3]:= a
>> Out[3]= $Aborted
>>
>> Print[a];Abort;Print[b]
>> a
>> b
>>
>> Andrzej Kozlowski
>>
>> On 5 Sep 2011, at 19:44, DrMajorBob wrote:
>>
>>> I, on the other hand, never saw Quit[] until this thread began.
>>>
>>> I suppose it figures that if Quit kills the kernel, then also Quit[any
>>> arguments or none] might also kill the kernel. (The other way 'round
>>> doesn't necessarily "figure", on the other hand.)
>>>
>>> Bobby
>>>
>>> On Mon, 05 Sep 2011 07:44:17 -0500, Andrzej Kozlowski
>>> <akoz@mimuw.edu.pl> wrote:
>>>
>>>> Actually (as far as I can tell) Quit is undocumented but Quit[] is:
>>>>
>>>> ?Quit
>>>> Quit[] terminates a Mathematica kernel session.
>>>>
>>>> I thought you had made a mistake but I tired just Quit (without the
>>>> brackets) and was surprised (after all these years!) to see it work. I
>>>> am wondering if there are more cases like this?
>>>>
>>>> Andrzej Kozlowski
>>>>
>>>> On 5 Sep 2011, at 13:06, 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
>>>>>
>>>>
>>> --
>>> DrMajorBob@yahoo.com

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


#4821

FromAndrzej Kozlowski <akoz@mimuw.edu.pl>
Date2011-09-07 12:29 +0000
Message-ID<j47o3j$mus$1@smc.vnet.net>
In reply to#4783
Of course it is not a great mystery if you define it yourself. After 
all, you can also define

ContextPath := $ContextPath

and you will have global variables not beginning with $, etc. The 
question is why: does WRI appear to violate what seem to be the logical 
foundations of Mathematica's language.

Andrzej Kozlowski


On 7 Sep 2011, at 11:40, Oleksandr Rasputinov wrote:

> Quit[Abort[]] doesn't quit; instead it gives $Aborted. (I dare say as 

> expected.)
>
> Quit vs. Quit[] performing the same operation isn't a great mystery: 
one 
> can define
>
> f := a
>
> and
>
> f[args___] := a
>
> and get the same result regardless of whether f is called as f or 
f[...]. 
> In general DownValues and OwnValues don't work like this, but 
providing 
> for such behaviour in a specific case is easy.
>
> On Tue, 06 Sep 2011 09:03:47 +0100, DrMajorBob <btreat1@austin.rr.com> 

> wrote:
>
>> Quit appears to quit as soon as it is parsed, regardless of 
arguments...
>> yet another poster found that, if it is the first line in a cell with
>> other statements, Mathematica doesn't quit until those other 
statements
>> are done, hence wiping out their effect.
>>
>> Quit[e] the conundrum.
>>
>> Bobby
>>
>> On Mon, 05 Sep 2011 13:15:07 -0500, Andrzej Kozlowski 
<akoz@mimuw.edu.pl>
>> wrote:
>>
>>> Well, I see it differently. All Mathematica functions have the form
>>> Head[arguments] where the number of arguments could be 0. Quit is
>>> therefore a Mathematica function, like Print[], Return[]. In fact,
>>> Quit[n] where n is an integer also works "passing the integer n as 
an
>>> exit code to the operating system" whatever that means. On the other
>>> hand, expressions of the form Abracadabra are normally just symbols 
and
>>> normally they do not perform any actions. In fact, do you know of 
any
>>> other example (except Quit) when when evaluating a symbols actually 
does
>>> more than return a value (that usually happens in the case of global
>>> constants, whose names begin with $,
>>>
>>> [1]:= $Version
>>>
>>> Out[1]= 8.0 for Mac OS X x86 (64-bit) (February 23, 2011)
>>>
>>> Note, by the way, that Abort[] works but Abort does not:
>>>
>>> In[3]:= Print[a];Abort[];Print[b]
>>> During evaluation of In[3]:= a
>>> Out[3]= $Aborted
>>>
>>> Print[a];Abort;Print[b]
>>> a
>>> b
>>>
>>> Andrzej Kozlowski
>>>
>>> On 5 Sep 2011, at 19:44, DrMajorBob wrote:
>>>
>>>> I, on the other hand, never saw Quit[] until this thread began.
>>>>
>>>> I suppose it figures that if Quit kills the kernel, then also 
Quit[any
>>>> arguments or none] might also kill the kernel. (The other way 
'round
>>>> doesn't necessarily "figure", on the other hand.)
>>>>
>>>> Bobby
>>>>
>>>> On Mon, 05 Sep 2011 07:44:17 -0500, Andrzej Kozlowski
>>>> <akoz@mimuw.edu.pl> wrote:
>>>>
>>>>> Actually (as far as I can tell) Quit is undocumented but Quit[] 
is:
>>>>>
>>>>> ?Quit
>>>>> Quit[] terminates a Mathematica kernel session.
>>>>>
>>>>> I thought you had made a mistake but I tired just Quit (without 
the
>>>>> brackets) and was surprised (after all these years!) to see it 
work. I
>>>>> am wondering if there are more cases like this?
>>>>>
>>>>> Andrzej Kozlowski
>>>>>
>>>>> On 5 Sep 2011, at 13:06, 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
>>>>>>
>>>>>
>>>> --
>>>> DrMajorBob@yahoo.com
>

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


#4836

From"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Date2011-09-08 09:32 +0000
Message-ID<j4a22r$447$1@smc.vnet.net>
In reply to#4783
It's most probably justified as being for the user's convenience.  
Personally I have always thought that referring to a symbol with delayed  
evaluation semantics and without any explicit parameters (a.k.a. a  
function with no arguments or options) as, for example, f[] is illogical,  
ugly, and inconsistent when it appears in Mathematica because one can just  
as well set OwnValues as DownValues, and doing the former more accurately  
expresses the intended meaning. Along this line of argument, Abort[]  
should indeed be Abort, especially since if actually called with any  
arguments Abort prints messages complaining about it. Obviously the only  
reason why there are such symbols is in a (probably misguided) effort to  
try to act more like other languages or environments: a similar argument,  
I suspect, explains Quit. Of course this doesn't excuse it, because Quit  
does in fact take a parameter, and mixing up the two unrelated concepts of  
functions vs. symbols with DownValues can only lead to confusion... but  
nothing's perfect. At least you can ignore Quit if you like and use Quit[]  
instead; not so, unfortunately, with the names and invocations of some of  
the Parallel` functions, which were comprehensively mangled when Maeder's  
Parallel Computing Toolkit became a part of Mathematica proper.

On Wed, 07 Sep 2011 13:29:39 +0100, Andrzej Kozlowski <akoz@mimuw.edu.pl>  
wrote:

> Of course it is not a great mystery if you define it yourself. After
> all, you can also define
>
> ContextPath := $ContextPath
>
> and you will have global variables not beginning with $, etc. The
> question is why: does WRI appear to violate what seem to be the logical
> foundations of Mathematica's language.
>
> Andrzej Kozlowski
>
>
> On 7 Sep 2011, at 11:40, Oleksandr Rasputinov wrote:
>
>> Quit[Abort[]] doesn't quit; instead it gives $Aborted. (I dare say as
>
>> expected.)
>>
>> Quit vs. Quit[] performing the same operation isn't a great mystery:
> one
>> can define
>>
>> f := a
>>
>> and
>>
>> f[args___] := a
>>
>> and get the same result regardless of whether f is called as f or
> f[...].
>> In general DownValues and OwnValues don't work like this, but
> providing
>> for such behaviour in a specific case is easy.
>>
>> On Tue, 06 Sep 2011 09:03:47 +0100, DrMajorBob <btreat1@austin.rr.com>
>
>> wrote:
>>
>>> Quit appears to quit as soon as it is parsed, regardless of
> arguments...
>>> yet another poster found that, if it is the first line in a cell with
>>> other statements, Mathematica doesn't quit until those other
> statements
>>> are done, hence wiping out their effect.
>>>
>>> Quit[e] the conundrum.
>>>
>>> Bobby
>>>
>>> On Mon, 05 Sep 2011 13:15:07 -0500, Andrzej Kozlowski
> <akoz@mimuw.edu.pl>
>>> wrote:
>>>
>>>> Well, I see it differently. All Mathematica functions have the form
>>>> Head[arguments] where the number of arguments could be 0. Quit is
>>>> therefore a Mathematica function, like Print[], Return[]. In fact,
>>>> Quit[n] where n is an integer also works "passing the integer n as
> an
>>>> exit code to the operating system" whatever that means. On the other
>>>> hand, expressions of the form Abracadabra are normally just symbols
> and
>>>> normally they do not perform any actions. In fact, do you know of
> any
>>>> other example (except Quit) when when evaluating a symbols actually
> does
>>>> more than return a value (that usually happens in the case of global
>>>> constants, whose names begin with $,
>>>>
>>>> [1]:= $Version
>>>>
>>>> Out[1]= 8.0 for Mac OS X x86 (64-bit) (February 23, 2011)
>>>>
>>>> Note, by the way, that Abort[] works but Abort does not:
>>>>
>>>> In[3]:= Print[a];Abort[];Print[b]
>>>> During evaluation of In[3]:= a
>>>> Out[3]= $Aborted
>>>>
>>>> Print[a];Abort;Print[b]
>>>> a
>>>> b
>>>>
>>>> Andrzej Kozlowski

[toc] | [prev] | [standalone]


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


csiph-web