Previous Up Next

5.42.5  Defining an n-tuple: tuple

To define an n-tuple, rather than a list of n objects, the objects should be put inside the delimiters tuple[ and ]. For example, the set consisting of the points [1,3,4], [1,3,5], [2,3,4 and [2,3,5] is written

set[tuple[1,3,4],tuple[1,3,5],tuple[2,3,4],tuple[2,3,5]]

The Cartesian product of two sets: *

The Cartesian product of two sets is computed with the infixed operator *.
Input:

set[1,2] * set[3,4]

Output:

set[tuple[1,3],tuple[1,4],tuple[2,3],tuple[2,4]]

Input:

set[1,2] * set[3,4] * set[5,6]

Output:

set[tuple[1,3,5],tuple[1,3,6],tuple[1,4,5],tuple[1,4,6], tuple[2,3,5],tuple[2,3,6],tuple[2,4,5],tuple[2,4,6]]

Previous Up Next