MathGroup Archive 2005

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

Search the Archive

Re: Help with output form?


A user wanted to make it so that evaluating
(lhs=rhs) would make the assignment and show
lhs=rhs in the output instead of just rhs.
The following more or less does this.


In[1]:=
  Unprotect[Set];
  $ModifySet=True;

  (lhs_=rhs_)/;$ModifySet:=
     Block[{$ModifySet}, lhs=rhs; HoldForm[lhs=rhs] ]

  Protect[Set];


In[5]:=
  y=Expand[(a+b)^2]

Out[5]=
  y = a^2 + 2 a b + b^2


But then you will have trouble if you use the above output cell to make a
new input expression.  That can be fixed if you use a package I have
posted at
  http://library.wolfram.com/infocenter/MathSource/705/

Then change HoldForm above to HoldTemporary.

----------
   Regards,
     Ted Ersek




  • Prev by Date: NET/Link return array from C++
  • Next by Date: Re: Problem with D and Abs
  • Previous by thread: Re: Re: Help with output form?
  • Next by thread: Re: Re: Help with output form?