Skip to content

Language Types

Fred Rothganger edited this page Feb 21, 2024 · 9 revisions

number – Floating point value. The precision is determined by the backend, and in some case may be specified by the user. All computation is done in this format. In particular, integer and Boolean values are treated as floats. Logical operators recognize 0 as false and nonzero as true. Logical operators return exactly 1 for true. A number is written as {digits}{dot}{digits}{exponent}{unit} or 0x{hexadecimal}{unit}. The optional unit follows the UCUM standard. In cases where the unit would produce an ambiguous parse, it may be surrounded by parentheses. Infinity can be written as ∞ or ".inf". Not-a-number can be written as ".nan".

matrix – A 1D or 2D raster of numbers. Used primarily for specifying and manipulating coordinates. A matrix constant has the following format: [1,2,3; 4,5,6; ...]. Rows are separated by semicolons. Values within a single row are separated by commas. The column count in the matrix is determined by the longest row. Any unspecified values in a row are treated as zero. Access an element of a matrix variable with the form M(row,column), where "M" is the name. Access the first column with the form M(row).

All binary operators on matrices are elementwise except as noted. Elementwise operators return a matrix with the same shape as the left operand. Missing elements in the right operand are given an identity value appropriate to the operator. Extra elements in the right operand are ignored.

reference – Points to a part instance as it exists at runtime. Any part that defines one or more references is called a "connection". Instances are ordered, such that all the relational operators (<,<=,==,!=,>=,>) on references have meaning. No other operators are allowed.

string – Text appearing "inside quote marks". Strings are capable of limited operations. They can be compared with the relational operators (<,<=,==,!=,>=,>). The addition operator (+) concatenates two strings. Strings may also be added with numbers. For example, "thing"+3 will become "thing3".