Compound Expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg29178] Compound Expressions
- From: aes <siegman at stanford.edu>
- Date: Fri, 1 Jun 2001 04:15:40 -0400 (EDT)
- Organization: Stanford University
- Sender: owner-wri-mathgroup at wolfram.com
I see that the following is what Mathematica does, so it's clearly what
Mathematica does:
In[147]:= a = 3; Remove["Global`*"]; a = 3; a
Out[147]= 3
In[148]:= a
Out[148]= a
In[149]:= a = 3; Remove["Global`*"]; Print[a]; a = 3; Print[a]
From In[149]:= Removed["a"]
From In[149]:= 3
In[150]:= a
Out[150]= a
What I don't understand is, not what Mathematica does here -- I'm not
interested in tracing out the details; I believe it happens --but *why*
the language would have to be designed to function in this (utterly
bizarre and utterly confusing) way?
To be more specific about this gripe:
* The "Remove" expression clearly removes "a" immediately when it is
encountered, as the output of In[149] in particular confirms.
* The subsequent "a=3" expression then clearly recreates "a" and
assigns it a value *after* the "Remove" has been processed, as both
In[147] and In[149] confirm.
So how does it make sense to have the "Remove" come back to life and
operate *again*, long after it should have been forgotten, so to speak?
Does it *have* to be designed this way?