MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Evaluation details

On 19 Mar 2008, at 11:26, Mumbo Jumbo wrote:
> Hello,
> I am quite puzzled why a Mathematica statement
> x=x+1;
> causes infinite recursion. Since the ducumentation states that the  
> lhs of
> this statement is not evaluated, it seems to me that the evaluation  
> of the
> rhs should not lead to recursive evaluation.
> TIA, Yuri.

The left hand side is not "pre-evaluated" but an OwnValue for x is  

In[3]:= Block[{$RecursionLimit = 20}, x = x + 1]
"reclim" : "Recursion depth of   20 exceeded."
Out[3]= Hold[x + 1] + 19

In[4]:= OwnValues[x]
Out[4]= {HoldPattern[x] :> Hold[x + 1] + 19}

and then the rhs is evaluated, this OwnValue applied, a new OwnValue  
for x created etc.

Andrzej Kozlowski

  • Prev by Date: finding positions of elements in a list
  • Next by Date: Re: Creating a function that is a derivative of another function??
  • Previous by thread: Evaluation details
  • Next by thread: Re: Evaluation details