Tuples
Tuple is a container type, composed of multiple fields. Each field can have a different type. Number of fields and their types must be known at compile time.
Tuple is represented by {}. It can span multiple lines. Fields can be assigned a name. Fields are separated by commas, trailing trailing comma is optional.
1. let var1 = {x = 1, y = 2}
3. let var2 = { # Span multiple lines
4. a = x,
5. b = y # Optional trailing comma
6. }
8. let var3 = {
9. c, # Individual item
10. d = b, # Assignment
11. }
Tuples are the type of a table row, which means that they are expected by many transforms. Most transforms can also take a single field, which will be converted into a tuple. These are equivalent:
PRQL
1. from employees
2. select {first_name}
SQL
1. SELECT
2. first_name
3. FROM
4. employees
PRQL
1. from employees
2. select first_name
SQL
1. SELECT
2. first_name
3. FROM
4. employees
Note
Prior to 0.9.0, tuples were previously named Lists, and represented with [] syntax. There may still be references to the old naming.
