About
A tuple is:
- a finite list of elements (fields) - It can only contain a specific number of elements.
- ordered by position
- that may have different types.
- and still be completely typesafe.
You can see tuple:
Example with a tuple assignement.
(x,y,z) = (2,4,'Bar')
would result in the following tuple:
<math> \begin{array}{rrr} 0 & \mapsto & x & \mapsto & 2\\ 1 & \mapsto & y & \mapsto & 4\\ 2 & \mapsto & z & \mapsto & Bar\\ \end{array} </math>
A Tuple has a schema defining each field
The term tuple comes from the set theory.
In set theory, an (ordered) n-tuple is a sequence (or ordered list) of n elements, where n is a non-negative integer.
Tuples are often used to describe other mathematical objects, such as vector
In a relational database, a tuple is called a row.
Size
Size | Name | Signature |
---|---|---|
1 | Unit | A |
2 | Pair | A, B |
3 | Triplet | A, B, C |
4 | Quartet | A, B, C, D |
5 | Quintet | A, B, C, D, E |
6 | Sextet | A, B, C, D, E, F |
7 | Septet | A, B, C, D, E, F, G |
8 | Octet | A, B, C, D, E, F, G, H |
9 | Ennead | A, B, C, D, E, F, G, H, I |
10 | Decade | A, B, C, D, E, F, G, H, I, J |
See also Function - Arity
Implementation
- Apache Commons tuple (of degree 1 until 3, ie only 1 to 3 columns)