Function Definitions

Each function definition has the following form:

<simple-identifier>(<simple-identifier>[, <simple-identifier>]*) = <expression>

A function definition can be thought of as a parameterized formula. Syntactically, it consists of two parts separated by “=”:

  • Left hand side: the function name followed by a parentheses-enclosed, comma-separated list of formal parameters. The function name and formal parameters are all simple identifiers.

  • Right hand side: an expression that may contain occurrences of the formal parameters specified in the left hand side

Each function definition ends with a line break.

The cost engine evaluates a function invocation by evaluating the right hand side of the function definition (in the same module) with a matching name, substituting the invocation’s actual parameters for the definition’s corresponding formal parameters. See Function Invocations for information on function invocations.

Note: CSL provides a number of predefined functions. See Predefined Functions for more information.

See the following topics for information on each syntactic category mentioned above: