(T1, T2, ...).
For example, (int, slice) — two values one by one.
Large tensors are generally impractical; structures are typically more suitable.
Essentially, structures are named tensors.
Syntax tensorVar.{i}
Access tensor components for reading and writing:
Structures as named tensors
StructUser below and a tensor (int, slice) have identical stack layouts and serialization rules:
obj.{field} is equivalent to tensorVar.{i}:
Destructuring at assignment
The following syntax is valid:(10, 20) assigned to two variables:
_ can be used on the left side:
Empty tensors are also valid values
Tensors vs tuples
A tuple is a special TVM primitive: it is a dynamic container capable of holding multiple values within a single stack slot. For example, a tensor(int, int, int) is “3 integers on the stack”, whereas a tuple with 3 integers is “one tuple on the stack”.
Tolk supports the tuple type. Read about tuples.