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

MathGroup Archive 2010

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

Search the Archive

Re: Foo /: Plus[b_Foo] := b

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114593] Re: Foo /: Plus[b_Foo] := b
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Thu, 9 Dec 2010 06:02:42 -0500 (EST)

Leonid Shifrin wrote:
> Hi kj,
> 
> Now you have entered the forbidden territory :)
> 
> Here is a very crude way to fix your example:
> 
> ClearAttributes[Plus, OneIdentity]
> 
> In[5]:= 1 + Foo[1]
> 
> Out[5]= 1 + Foo[1]
> 
> SetAttributes[Plus, OneIdentity]
> 
> Have a look at attributes Flat and OneIdentity (they tend to be considered
> together, and
> for a good reason), both in the Help, and, even better, in some past
> Mathgroup discussions,
> for the explanation. But this is not for the faint-hearted :).
> 
> The bottom line: your UpValue is not at all innocent, given the set of
> Arttributes of Plus.
> 
> Hope this helps.
> 
> Regards,
> Leonid

There are early references in popular culture. The illustrious Mr. T 
said something to the effect that "I pity the Foo who mixes UpValues 
with OneIdentity."

Daniel Lichtblau
Wolfram Research


  • Prev by Date: Solving matrix equations
  • Next by Date: Re: 8.0 Control Systems ToDiscreteTimeModel[]
  • Previous by thread: Re: Foo /: Plus[b_Foo] := b
  • Next by thread: Re: Foo /: Plus[b_Foo] := b