Re: Help with output form?
- To: mathgroup at smc.vnet.net
 - Subject: [mg60986] Re: Help with output form?
 - From: ted.ersek at tqci.net
 - Date: Thu, 6 Oct 2005 04:08:27 -0400 (EDT)
 - Sender: owner-wri-mathgroup at wolfram.com
 
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
- Follow-Ups:
- Re: Re: Help with output form?
- From: Andrzej Kozlowski <andrzej@yhc.att.ne.jp>
 
 
 - Re: Re: Help with output form?