|
|
On Wed, 19 Sep 2001 00:20:42 -0400, "Slime" <noo### [at] hotmailcom>
wrote:
> Yeah, it makes sense now... I wish there were some way to force the function
> to store a value just so that the same value doesn't have to be calculated
> multiple times.
but you can do that !
just take another level of function
imagine - you want something like (in your expected notation)
#declare MyFunc=function(x,y,z){
#local A=x+y+z;
#local B=max3(x,y,z);
(A*x/B)+(A*y/B)+(A*z/B)
} // I don't know what's this expression feel free to test
this can't work, but you can replace this with two declarations
#declare WithLocals=function(x,y,z,A,B){
(A*x/B)+(A*y/B)+(A*z/B)
}
#declare MyFunc=function(x,y,z){WithLocals(x,y,z,x+y+z,max3(x,y,z))}
I don't know 3.5 engine yet but I think it causes one calculation of
such local variables.
ABX
Post a reply to this message
|
|