Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Why Evaluate[Defer[1+1]] does not return 2 ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110942] Re: Why Evaluate[Defer[1+1]] does not return 2 ?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Tue, 13 Jul 2010 05:26:15 -0400 (EDT)

I think that Defer is intended for something like the following:

{PasteButton[1 + 1], PasteButton[Defer[1 + 1]]} 

Evaluate, use the second button, and then evaluate the pasted result.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Nasser M. Abbasi [mailto:nma at 12000.org] 


I am a little confused about Defer:

r = Defer[1 + 1]
Out[106]= 1 + 1

Evaluate[r]
Out[109]= 1 + 1

But help says:

"Defer[expr] returns an object which remains unchanged until it is 
explicitly supplied as Mathematica input, and evaluated using 
Shift+Enter, Evaluate in Place, etc. "

Isn't typing Evaluate[r]  the same as Evaluate in Place mentioned above?

?Evaluate

"Evaluate[expr]
causes expr to be evaluated even if it appears as the argument of a 
function whose attributes specify that it should be held unevaluated."

Isn't "r" above is the object in question whose value is 1+1?

Actually, typing "r" itself, (same as typing Evaluate[r]) does return 
"1+1".

In[117]:= r
Out[117]= 1 + 1

I think I know what is the problem now, I am going by that "r" is the 
expression whose value is "1+1". I think this is the problem. "r" is not 
the expression, it is "1+1" which is the expression. "r" is just another 
name for Defer[1+1]. Am i getting close?

--Nasser







  • Prev by Date: Re: Simplest way to get 2 digits from an integer...
  • Next by Date: Re: Fast pricer for American options
  • Previous by thread: Why Evaluate[Defer[1+1]] does not return 2 ?
  • Next by thread: Restricting file type with SystemDialogInput