[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Creating a Tuple

Creating a Tuple

elt< C | a_1, a_2, ..., a_k > : SetCart, Elt, ..., Elt -> Tup
C ! < a_1, a_2, ..., a_k > : SetCart, Elt, ..., Elt -> Tup
Given a cartesian product C = R _1 x ... x R_k and a sequence of elements a_1, a_2, ..., a_k, such that a_i belongs to the set R_i (i = 1, ..., k), create the tuple T = < a_1, a_2, ..., a_k > of C.

< a_1, a_2, ..., a_k > : Elt, ..., Elt -> Tup
Given a cartesian product C = R_1 x ... x R_k and a list of elements a_1, a_2, ..., a_k, such that a_i belongs to the set R_i, (i = 1, ..., k), create the tuple T = < a_1, a_2, ..., a_k > of C. Note that if C does not already exist, it will be created at the time this expression is evaluated.

Example Tup_Tuple (H9E2)

We build a set of pairs consisting of primes and their reciprocals.

> C := car< Integers(), RationalField() >;
> C ! < 26/13, 13/26 >;
<2, 1/2>
> S := { C | <p, 1/p> : p in [1..25] | IsPrime(p) };
> S;
{ <5, 1/5>, <7, 1/7>, <2, 1/2>, <19, 1/19>, <17, 1/17>, <23, 1/23>, <11, 1/11>, 
<13, 1/13>, <3, 1/3> }

[Next] [Prev] [Right] [Left] [Up] [Index] [Root]