Re: Need a new type of Hold
- To: mathgroup at smc.vnet.net
- Subject: [mg7538] Re: Need a new type of Hold
- From: "David B. Wagner" <dbwagner at princon.com>
- Date: Fri, 13 Jun 1997 03:08:53 -0400 (EDT)
- Organization: Principia Consulting
- Sender: owner-wri-mathgroup at wolfram.com
Ersek_Ted%PAX1A at mr.nawcad.navy.mil wrote:
> I could use a new type of Hold that is similar to HoldForm.
> The difference is I don't want the new Hold to show up in
> the FullForm.
> Lets call this new feature HoldTemporary.
> The following shows the way I want it to work.
> In:= foo=HoldTemporary[z+2+d+a+3]
> Out= z+2+d+a+3
> In:= foo-d+4
> Out= 9+a+z
At first I thought that what you really want to do is define your
own addition operator, but then I decided thathat you are trying to
do is fundamentally inconsistent with the way
Mathematica works (I won't say "impossible", since everytime I say
that some smart-aleck figures out a way to do it.)
in your first output, the 2 and the 3 don't combine. Yet, in the second
output, they have combined with the 9. What should happen if I type
"foo + b"? Should the result be "z+2+d+a+3+b" or should it be
"5+a+d+a+b". Or should it be something else? The fact is, if you want
the 2 and 3 to combine, then they should have combined in the first
output; if you want the order of the terms to be strictly maintained,
then the second output should have been "z+2+d+a+7" (let's assume that
it's okay to combine adjacent terms). One or the other, you can't
have it both ways.
By the way, if it's a non-associative addition operator that you're
after, I don't recommend removing the Orderless attribute from Plus,
or you'll break a lot of other things.
Voice: (500) PRN-CPIA or (303) 258-9178
Fax: (303) 258-3859
Prev by Date:
swap orgy with v.3
Next by Date:
Re: List plot with + possible?
Previous by thread:
Need a new type of Hold
Next by thread:
Re: Re: Need a new type of Hold