Vectors
Vectors are the equivalent of Python's built-in lists with the difference that vectors are homogeneous. Hence they are always declared with a corresponding parameter type.
Customizing vectors
A vector accepts an arbitrary number of items by default and uses a list internally to store these items. Since a cuboid has three dimensions it would be convenient to fix the number of elements and to use a tuple instead of a list:
Alternative syntax
Different syntax for setting the container type or restricting the number of elements is available (the methods and operators return the parameter instance, so they can be chained):
Emulating N-tuples
Since creating a vector of specific type with a specific length is common task there is a even more concise syntax for that:
This creates an Integer vector with the number of elements restricted to 3 and using a tuple to store the elements.
Vectors of specific types
In order to facilitate reusing vectors of a specific type you can create a template by doing:
Applying constraints
Any constraints applied to vectors are applied to each of their elements. For example:
This does not hold for constraints on meta characteristics such as Vector.len
. This type of constraint is applied to the vector itself.
Last updated