Several kinds of aggregate objects are available in Magma. The bracketing for them is shown below:
The length of a set, sequence or tuple M is #M.
Sets and record fields are unordered; sequences and tuples are ordered. The n-th entry of a sequence or tuple M is M[n].
All members of a set or sequence must belong to the same parent magma. The members of tuples may belong to different parents, and these parents are the components of the Cartesian product to which the tuple belongs. The members of records are fields that have names and parents defined by the record format created for the record.
Enumerated set of integers:
> A := { 4, 6, 2 };
Sequence of permutations:
> B := [ Sym(5) | (4, 1, 2), (2, 4)(1, 5) ];
Tuple belonging to the Cartesian product of the rational
field and a polynomial ring:
> P<x> := PolynomialRing(GF(13));
> C := < 15/8, x^5 + 3 >;
> print Parent(C);
Cartesian Product<Rational Field, Univariate Polynomial
Algebra in x over Finite field of size 13>
A record format and record that are similar to the
Cartesian product and tuple above:
> F := recformat< fraction : RationalField(), poly : P >;
> R := rec< F | fraction := 15/8, poly := x^5 + 3 >;
> print R;
rec<F | fraction := 15/8, poly := x^5 + 3>
A set constructor:
> print { g : g in Sym(4) | Order(g) eq 2 };
{
(1, 3)(2, 4),
(2, 3),
(3, 4),
(1, 2),
(2, 4),
(1, 3),
(1, 4)(2, 3),
(1, 4),
(1, 2)(3, 4)
}