---
title: "Tuple Access Functions"
canonical: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/tuple-access.html"
source: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/tuple-access.md"
part: "Sets, Sequences, and Mappings"
chapter: "Tuples and Cartesian Products"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Sets, Sequences, and Mappings", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/index-sets-sequences-mappings.md"}
  - {"title": "Tuples and Cartesian Products", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/index-tuples-cartesian-products.md"}
prev: {"title": "Creating and Modifying Tuples", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/tuple.md"}
next: {"title": "Equality", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/TuplesCartesianProducts/Boolean.md"}
intrinsics:
  - {"name": "Parent", "signature": "Parent(T): Tup -> SetCart"}
  - {"name": "#", "signature": "# T: Tup -> RngIntElt"}
  - {"name": "T[i]", "signature": "T[i]: Tup -> Elt"}
  - {"name": "Explode", "signature": "Explode(T): Tup -> t1, t2, ..."}
  - {"name": "TupleToList", "signature": "TupleToList(T): Tup -> List"}
  - {"name": "Tuplist", "signature": "Tuplist(T): Tup -> List"}
examples:
  - "ex-58b218"
---

# Tuple Access Functions

<a id="function-parent-tup"></a>
## `Parent(T): Tup -> SetCart`

The cartesian product to which the tuple $T$ belongs.

<a id="operation-operation-tup-rngintelt"></a>
## `# T: Tup -> RngIntElt`

Number of components of the tuple $T$.

<a id="literal-literal-t-i-tup-elt"></a>
## `T[i]: Tup -> Elt`

Return the $i$-th component of tuple $T$. Note that this indexing can also be used on the left hand side for modification of $T$.

<a id="function-explode-tup"></a>
## `Explode(T): Tup -> t1, t2, ...`

Given a tuple $T$ of length $n$, this function returns the $n$ entries of $T$ (in order).

<a id="function-tupletolist-tup"></a>
## `TupleToList(T): Tup -> List`

<a id="function-tuplist-tup"></a>
## `Tuplist(T): Tup -> List`

Given a tuple $T$ return a list containing the entries of $T$.

<a id="example-ex-58b218"></a>
## `Example: Accessing Tuple Entries (ex-58b218)`

```magma
> f := < 11/2, 13/3, RootOfUnity(3, CyclotomicField(3)) >;
> f;
<11/2, 13/3, (zeta_3)>
> #f;
3
> Parent(f);
Cartesian Product<Rational Field, Rational Field, Cyclotomic field Q(zeta_3)>
> f[1]+f[2]+f[3];
(1/6) * (59 + 6*zeta_3)
> f[3] := 7;
> f;
<11/2, 13/3, 7>
```
