A tuple groups a small, fixed number of terms in positional order. It suits record-like values whose fields are known ahead of time; use a list for a dynamically sized collection. section 2.4.3 section 2.8
Work with tuple fields through positional operations:
- Create a tuple such as {"Bob", 25}. section 2.4.3
- Read a field with elem(tuple, index); indexes are zero-based. section 2.4.3
- Update a field with put_elem(tuple, index, value), which returns a new tuple rather than modifying the old one. section 2.4.3 section 2.4.5
Rebinding an updated tuple
person = {"Bob", 25} older_person = put_elem(person, 1, 26) person remains {"Bob", 25}, while older_person contains {"Bob", 26}. Rebinding person to the returned value is also valid. Updating creates a complete shallow copy; nested values are shared where possible. section 2.4.3 section 2.4.5














