3.9 Tuple
A tuple is a compound data type with a fixed number of terms:
- {Term1,...,TermN}
Each term Term in the tuple is called an element. The number of elements is said to be the size of the tuple.
There exists a number of BIFs to manipulate tuples.
Examples:
- 1> P = {adam,24,{july,29}}.
- {adam,24,{july,29}}
- 2> element(1,P).
- adam
- 3> element(3,P).
- {july,29}
- 4> P2 = setelement(2,P,25).
- {adam,25,{july,29}}
- 5> tuple_size(P).
- 3
- 6> tuple_size({}).
- 0