Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Reevaluation of conditional arguments when the condition has changed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61107] Re: Reevaluation of conditional arguments when the condition has changed
  • From: albert <awnl at arcor.de>
  • Date: Mon, 10 Oct 2005 02:40:09 -0400 (EDT)
  • Organization: Arcor
  • References: <200510080649.CAA20991@smc.vnet.net> <diabpq$iim$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Igor,
 
> You shouldn't expect it because you're using the Set function (=).  When
> you call:
> 
> expr1 = foo[a b]
> 
> It evaluates the rhs (giving "foo[a b]") and sets that *value* to the
> value of
> expr1.  Note it's *not* the function definition foo[a b], but it's value.
> Its value just happened to be the "unevaluated value", but it's still its
> value. When you modify the foo function and reevaluate expr1 (I'm assuming
> you're simply doing "expr1" in a new cell), you're simply getting that
> value that was stored in the variable.
> 
> That is the whole idea behind using Set vs. SetDelayed ( := )

I don't agree, otherwise the following would be a bug:

In[1]:= a=b

Out[1]= b

In[2]:= b=1

Out[2]= 1

In[3]:= a

Out[3]= 1

I think the difference between Set and SetDelayed is not the point in what
David asked and I also guess that he is very aware of that difference. The
question is whether the observation he made is an indiaction of a bug or
not. I think it is a bug, even though Carl Woll has posted a workaround and
that makes it not a severe problem. Maybe it would be a good idea to at
least mention the use of UpValues as one of the possible "special
circumstances" in the Update help. On the other hand, the usage of UpValues
doesn't seem to be so special after all...

albert


  • Prev by Date: Problem with circles in complex plane
  • Next by Date: Re: Language vs. Library
  • Previous by thread: Re: Reevaluation of conditional arguments when the condition has changed
  • Next by thread: Re: Re: Reevaluation of conditional arguments when the condition has changed