Arguments

The Arguments section describes what each input argument in the primitive's format is intended to represent. The type of data you must supply in the argument's place is indicated using data type codes such as (num), [num], and {num}. Any data type code with parentheses around it, such as (num), means the expression you put in the argument's place must return a single value. Codes with brackets, such as [num], mean a list of the indicated data type. Codes with braces, such as {num} mean the input data can be a list but each item in the list is treated independently.

The codes [num] and {num} both represent a list of values. The difference is [num] means the list is treated as a whole while {num} is not. For example, the sum primitive has an input data type of [num]. Sum adds up all values in the input list and returns a single total. The abs primitive has an input data type of {num}. This means if you supply a list of input numbers, abs returns a list containing the absolute value of each item in the list.

Following is a complete list of all of the data type codes used in the Arguments section of the primitive descriptions:

Arguments

Argument Description
any Number, text string, or Boolean value
int Integer (e.g., -1, 0, 5, 3e89)
real Real number (e.g., -3.14, 5, 3e-89)
unit Real number with optional units (e.g., 3.5sec)
comp Real or complex number (e.g., 3.1+2.3i, i, 5)
num Real or complex number with optional units
text Text string (e.g., "A text string")
bool True, false, or any number; zero is considered to be false and all other numbers are true
(node) Name of a node or variable (without quotation marks)
[node] List of node names expressed as text strings; [node] is identical to [text] except an abbreviated notation is allowed, e.g., "node1,node2,node3" is equivalent to ["node1","node2","node3"].

The data type codes and argument descriptions apply to the value returned by an expression in the argument's place, not the expression itself. For example, the sin primitive has the format sin(x) where the argument x is any number (num). This does not mean the expression you type in the argument's place must be a number literal, such as sin(3). Instead, the argument can be any expression that returns a number. Therefore, expressions such as

sin(PI/2)

and

sin(asknumber("Give me a number:"))

are fine.

See Primitive Description Format.