Expression Syntax

Revision as of 16:25, 17 April 2007 by Lchrisman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Function Calls

Analytica contains many built-in functions, and you can extend these with User-Defined Functions. The syntax for calling an expression is:

F(A,B,C)

where the parameter values A,B, and C may themselves be Analyica expressions. For most (but not all) built-in functions and all User-Defined Functions, parameter values can be listed either by position or by name, or a combination. For example, the following four examples are all identical calls to the function Uniform, specifying parameters by position, by name, and by a combination:

Uniform( 1,100,true )
Uniform( min:1, max:100, Integer:true )
Uniform( Integer:true, min:1, max:100 )
Uniform( 1,100,Integer:true )

Each of these function calls defines a uniform distribution on the integers from 1 to 100. When specifying a parameter by name, the parameter name is followed by a colon, which is then followed by the parameter value.

When parameters are specified by name, they can be specified in any order, as the third example demonstrates. However, once one parameter is specified by name, all parameters that follow must be specified by name.

When a function expects an index or variable parameter, an object identifier must occupy that parameter position. The dot-operator syntax, A.I,may also be used. However, arbitrary expressions, including function calls, cannot appear as a value to an index or variable parameter.

Parameter values are evaluated in various ways when a function call is evaluated, depending on the specific parameter qualifiers in the declaration for the function, and on the evaluation mode when the function is evaluated.

Operator Precedence

Comments


You are not allowed to post comments.