Synopsis Tuple values.
Syntax < Exp1, Exp2, ... >
Exp1 Exp2 ... < Exp1, Exp2, ... >
T1 T2 ... tuple[T1, T2, ... ]
Description A tuple is a sequence of elements with the following properties:
  • Each element in a tuple (may) have a different type.
  • Each element of a tuple may have a label that can be used to select that element of the tuple.
  • Each tuple is fixed-width, i.e., has the same number of elements.
Tuples are represented by the type tuple[T1 L1, T2 L2, ...], where T1, T2, ... are arbitrary types and L1, L2, ... are optional labels.

The following functions are provided for tuples:
rascal>tuple[str first, str last, int age] P = <"Jo","Jones",35>;
tuple[str first,str last,int age]: <"Jo","Jones",35>
str: "Jo"
rascal>P.first = "Bo";
tuple[str first,str last,int age]: <"Bo","Jones",35>

Question [1]. For a tuple:

Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit