The CONST Function

In the usual processing of defined values, the definition is expanded inline in any referring expression, and recomputed in the environment of the containing evaluation.

 

With functions like RANDOM(), this causes a new random value to be computed at each evaluation, instead of defining a single value to be used throughout the remaining computation.

 

The CONST function has been added to cure this problem.

       

result = CONST(expression)        

 

computes the value of expression once when the script is first read, and treats the value as if it had been entered as a literal number.        

 

expression must be computable in the global environment, and must not use any spatially-dependent or time-dependent values.