       RE: Re: Evaluation of args in pure functions

• To: mathgroup at smc.vnet.net
• Subject: [mg17128] RE: [mg17066] Re: [mg16924] Evaluation of args in pure functions
• From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
• Date: Sat, 17 Apr 1999 03:35:17 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```Wolf Hartmut sent the post:
Subject: [mg17128] [mg17066] Re: [mg16924] Evaluation of args in pure functions

In that post he took a close look at certain aspects of the Mathematica evaluation
process.
-----------------------------

Tip:
Probably the most detailed description available on the evaluation process
is in Chapter 7 of the book "Power Programming with Mathematica the Kernel",
by David Wagner.  Although I don't David Wagner covers the nuances Wolf
discussed.

In addition David Wagner doesn't discuss a little detail on page 322 of the
big book from Wolfram.  Below I take the example from the big book a step
further.

In:=
ClearAll[g,h];
g=h;
h=5;
g[1+1]=4+6

Out=
10

In:=
?g
"Global`g"
g = h

Above we see there is no definition for g or g[1+1].
----------------------------

In:=
?h
"Global`h"
h = 10

Above we see the earlier definition
for (h) was changed to h=10.

----------------------------

You can evaluate (g[1+1]=4+6) inside TracePrint and see the order of how
things are evaluated.
It goes like this:

The right side evaluates as
4+6 --> 10

The head of the left side evaluates as
g --> h

The argument of the left side evaluates as
1+1 --> 2

We now have h on the left side of Set (=).  The expression h doesn't
evaluate any further and we have the expression ( h=10 ).  The value (10)
is assigned to ( h ), and an appropriate output cell is sent to the Front
End.

Regards,
Ted Ersek

```

• Prev by Date: Re: List of function-heads
• Next by Date: Re: List of function-heads
• Previous by thread: Re: Evaluation of args in pure functions
• Next by thread: overwrite separate notebook