MathGroup Archive 1999

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

Search the Archive

Re: ... but true

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16625] Re: ... but true
  • From: "Peltio" <pelt.ioNOS at PAMiol.it>
  • Date: Fri, 19 Mar 1999 12:53:50 -0500
  • Organization: Peltio Inc.
  • References: <7cnl3i$e6f@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The problem,I guess, is all here: your assignment was made to A[1,2],
and stored by Mathematica

?A
    Global`A
    A[1, 2] = A[3, 2]

So, when you made the assignment a=A[1,2],
Mathematica automatically changed it to a=A[3,2].

I did not understand the reason of xASet (Abstraction?), though.
How about using this procedure?
xASet[A[x_,y_],z_]:=A[z,y]

Hope that helps,
Peltio
peltioNOS at PAMusa.net

schatzi wrote in message <7cnl3i$e6f at smc.vnet.net>...
>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]}


Allow me to dissent on this point. The answer here is
=> {A[3,2],A[1,5]}

>antoine.zahnd at iprolink.ch







  • Prev by Date: Fitting a piecewise continuous Function
  • Next by Date: Re: Re: Problem: Smallest sphere including all 3D points
  • Previous by thread: RE: Fitting a piecewise continuous Function
  • Next by thread: Header/Footer settings in StyleSheets