Attributes of a function

Like other objects, a function is defined by a set of attributes. It shares many of the attributes of variables, including identifier, title, units, description, and definition, inputs, and outputs. It has a unique attribute, Parameters, which specifies the parameters available to the function.


If you are creating a library of functions, make a descriptive identifier. This identifier appears in the function list for the library under the Definition menu, and is used to call the function. Analytica makes all characters except the first one lower case.


If you are creating a library of functions, limit the title to 22 characters. This title appears in the Object Finder dialog to the right of the function.


If desired, use the units field to document the units of the function’s result. The units are not used in any calculation.


The parameters to be passed to the function must be enclosed in parentheses, and separated by commas. For example:

(x, y, z: Number)

Parameters may have parameter qualifiers, such as Number above after a colon ':' following the parameter(s) to which they apply. Parameter qualifiers may specify the type of parameters, such as Number, Text, Boolean, Handle, index, or Variable, the dimensions, such as Atom, List, or Array, in which case you can specify which Index(es) it needs. You can also specify that a parameter is Optional or may be Repeated.

You can make functions easier to understand and use by giving the parameters meaningful names, in a logical sequence. The parameters appear in the Expression assist popup window as you enter the function parameters. When you select a function from the Definition menu, it copies its name and parameters into the current definition.


The description should describe what the function returns, and explain each of its parameters. If the definition is not immediately obvious, a second part of the description should explain how it works. The description text for a function in a library also appears in a scrolling box in the bottom half of the Object Finder dialog.


The definition of a function is an expression or compound list of expressions. It should use all of its parameters. When you select the definition field of a function in edit mode, it shows the Inputs pull-down menu that lists the parameters as well as any other variables or functions that have been specified as inputs to the function. You can specify the inputs to a function in the same way as for a variable, by drawing arrows from each input node into the function node.


Set to 1 (true) if the function is recursive — that is, it calls itself. This attribute is not initially displayed. Use the Attributes dialog from the Object menu to display it. See For and While Loops and Recursion.

See Also


You are not allowed to post comments.