Composite types
Most pins have a single named type, such as number or
Circle. Composite types are built from other types:
lists of values, functions, and generic pins whose type is set by what
they're connected to.
Primitives
number, boolean and string are plain values. Numbers have no
separate integer type: nodes that need whole numbers (such as an array
index) report an error for anything else. Angles are always in radians.
Arrays
Array<T> is an ordered list of values of type T: Array<Point> is a
list of points, Array<Array<number>> a list of lists of numbers.
- Handles of array pins are square, in the color of their elements.
- Subtypes carry over: an
Array<Circle>connects to anArray<Shape>input. - Building them. The array nodes make, combine and slice arrays. An unconnected array input is an empty array.
- Not editable. Array inputs can't be set in the property inspector: connect them instead.
- Drawing them. The Output and
Group nodes'
objectsinput also takes an array of objects: each element counts as a connection of its own. Other inputs that take several connections take single values only.
Functions
Function(A, B) -> (C) is a value that is itself a small graph: it takes
an A and a B and gives a C. Nodes such as
Map, Filter,
Reduce and Repeat
take a function and call it once per element or iteration.
- Handles of function pins are diamonds.
- Parameters are positional. Names are only labels; what counts is the order and the types.
- Compatible functions. A function connects where one with the same number of parameters and results is expected, if it accepts at least the expected parameter types and gives results of the expected types (or subtypes).
- Extra parameters. A
...at the end of the parameters, as inFunction(T, number, ...) -> (U), means the function may take more parameters. Their values come from the node'sargumentsinput.
Generic pins
Some pins have a type variable, such as T, instead of a type: Get
takes an Array<T> and gives a T, for any T.
- The first connection decides. Connecting an
Array<Circle>to Get makesTa Circle on that node: its output is then a Circle, and its otherTpins only take Circles (or subtypes). - Handles of unresolved generic pins are hollow, and take their color once the variable is set.
- Disconnecting the wires that set a variable makes it free again. Wires that only fit the old type are removed.
- No constants. Generic inputs can't be set in the property inspector.
Related pages
- Pin types and colors and Generic pins, in more detail.
- All types.
- Nodes, whose pin tables show each pin's type.