MathGroup Archive 1999

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

Search the Archive

unbelievable ...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16567] unbelievable ...
  • From: schatzi <antoine.zahnd at iprolink.ch>
  • Date: Wed, 17 Mar 1999 23:54:51 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

I just came accross something that I *DO NOT* understand.

Let A be a structure with two componants x and y and xA and yA functions
that return its x and y
componants.

ClearAll[A,xA,yA]
xA[A[x_,y_]]:=x
yA[A[x_,y_]]:=y

So far everything is fine ...

{a=A[1,2],xA[a],yA[a]}
=> {A[1,2],1,2}

Now I would like to have a function which sets the x componant of a A
symbol.
I guess the following is not only far from the state of art, but deeply
wrong:

xASet[A[x_,y_],z_]:=(A[x,y]=A[z,y])

The first use seems ok:

{a,xASet[a,3],a}
=> {A[1,2],Null,A[3,2]}

But now it is impossible to reset a to A[1,2] (and only to A[1,2] !!!)

{a=A[1,2],a=A[1,5]}
=> {A[3,1],A[1,5]}


Thank you very much for your help.


antoine.zahnd at iprolink.ch




  • Prev by Date: Footers
  • Next by Date: Re: Eliminating a "Unit"
  • Previous by thread: Footers
  • Next by thread: Re: unbelievable ...