Substitution in a function



I guess the following is what you need

(C6) block(f[0]:u-v+3*w, for i:1 thru 2 do 
f[i]:''sublis([u=v,v=w,w=u],f[i-1]));
(D6)                                 DONE
(C7) [f[0],f[1],f[2]];
(D7)               [3 w - v + u, - w + v + 3 u, w + 3 v - u]
(C8)
On Tuesday 24 September 2002 09:05, Neilen wrote:
> Hi.
>
> I'm trying to permute some functions w.r.t. the variables they are
> using.
>
> For example, I have a function
>
> (C93) f:u-v+3*w;
>
> (D93) 				  3 w - v + u
>
> then, I "rotate" the vars like this:
>
> (C94) f:f,u=v,v=w,w=u;
>
> (D94) 				 - w + v + 3 u
> which is what I want.
>
> But how can I achive it within a function.  If I go
>
> func(p):=( .. stuff ...
> 	f:u-v+3*w,
> 	... stuff ..
> 	f:f,u=v,v=w,w=u,
> 	... stuff that uses the new f...
> )
>
> the substitutions seem to have no effect.  The subst functions seems
> only to allow one substitution at a time, so I can't use it, it seems.
>
> Help appreciated
>
> Thanks
> Neilen