[Date Index]
[Thread Index]
[Author Index]
RE: RE: Re: Is it possible to access internal variables?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg34786] RE: [mg34749] RE: [mg34709] Re: [mg34705] Is it possible to access internal variables?
*From*: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
*Date*: Thu, 6 Jun 2002 01:55:14 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
Bobby,
yes, this can be read at Allan's post I cited. Indeed we can do
arbitrary
funny things
In[1]:= (pr =.;
{Print[pr], pr = Print, pr[2]};
Evaluate[{Hold[Print[1]], pr[3]}] )//ReleaseHold
>From In[1]:= pr
>From In[1]:= 2
>From In[1]:= 3
>From In[1]:= 1
Out[1]= {Null, Null}
In[2]:= In[1]
>From In[2]:= 3
>From In[2]:= pr
>From In[2]:= 2
>From In[2]:= 1
Out[2]= {Null, Null}
--
Hartmut
> -----Original Message-----
> From: DrBob [mailto:majort at cox-internet.com]
To: mathgroup at smc.vnet.net
> Sent: Wednesday, June 05, 2002 4:26 PM
> Cc: 'David Park'; BobHanlon at aol.com
> Subject: [mg34786] RE: [mg34749] RE: [mg34709] Re: [mg34705] Is it possible to
> access internal variables?
>
>
> >>The expressions e1, e2, up to en are executed in order
>
> No, unfortunately.
>
> (If we can't say what the rules are, we're permanently in trouble.)
>
> pr=.;
> {Print[pr],pr=Print,pr[2]};Evaluate[{Print[1],pr[3]}]
>
> 1
> pr
> 2
> 3
> {Null,Null}
>
> "Evaluate" is taken out of sequence so that "1" is printed first.
>
> I can adjust to this if I know in advance which statements
> will be taken
> out of order. Is Evaluate the only case?
>
> For now, I'll remember that I don't want to enclose in
> Evaluate anything
> that might have side-effects. Even if I WANT those side-effects to
> occur first in a compound expression, it's smarter to put them at the
> beginning so that they occur when a na=EFve reader would expect it.
>
> Bobby Treat
>
> -----Original Message-----
> From: Wolf, Hartmut [mailto:Hartmut.Wolf at t-systems.com]
To: mathgroup at smc.vnet.net
> Sent: Wednesday, June 05, 2002 4:09 AM
> Cc: 'David Park'; BobHanlon at aol.com
> Subject: [mg34786] RE: [mg34749] RE: [mg34709] Re: [mg34705] Is it possible to
> access internal variables?
>
> Hello Bobby,
> Two things: (1) as Hob Hanlon has pointed out, I missed to assign to
v
> at definiton of h[x_], which of course explains everything. Aside
from
> being this my standard blunder mixing up Append with AppendTo
> in my mind
> from my first day on with Mathematica, I did not look close
> enough, and
> finally: there are no mysteries. Sorry for disturbing you.
> (2) What considers CompoundExpression: this is no bug for
> shure; instead
> we simply have to recognize the precise semantics of (e1; e2; ...;
en)
> The expressions e1, e2, up to en are executed in order, then
> the result
> of en is assigned to CompoundExpression[e1, e2, ..., en] and then
this
> is evaluated again. Normaly, this has no visible effect since the
> execution environment of en when evaluated within the
> CompoundExpression
> is the same as that of the CompoundExpression when it
> returns; yet this
> is not enough. Here, since FindMinimum fails it returns itself
> unevaluated (a standard behaviour), this now becomes the value of
> CompoundExpression and such FindMinimum will start anew.
> This all conforms to the execution sequence as specified for
> Mathematica. We certainly should have internalized this precisely and
> permanently (as a morning prayer). However, we are human beings, and
> build up our own rules in our heads and take many shortcuts.
> It's there
> where we often become irritated. We just have concede that
> In[1]:= expr1
> In[2]:= expr2
> is *not* the same as
> In[1]:= expr1;
> expr2
> As I mentioned I've seen a prior thread to this theme with a
prominent
> contribution of Allan Hayes, e.g.
> http://library.wolfram.com/mathgroup/archive/1999/Feb/msg00460.html
or
> see also my reply to Allan at another thread
> http://library.wolfram.com/mathgroup/archive/2000/Jul/msg00115.html .
> BTW esp. with Block, things are quite the same, and quite common
here,
> since the execution
> environment within Block almost always differs form that one
> outside: we
> have to anticipate the transformations to the _result_ of
> Block, as here
> to the _result_ of CompoundExpression.
> --
> Hartmut
>
>
--snipped--
Prev by Date:
**RE: Re: Warning Messages on Notebooks Produced by Later Versions**
Next by Date:
**MathML Conference: Final Announcement**
Previous by thread:
**RE: RE: Re: Is it possible to access internal variables?**
Next by thread:
**RE: RE: Re: Is it possible to access internal variables?**
| |