Tuple#
- class discopy.closed.Tuple(*terms)[source]#
Bases:
CompoundThe tupling of terms, its codomain is the
Productof theirs. The empty tuple has the empty type as codomain, i.e. the nullary product is strict, so that terms of unit type stay type-preserving.- Parameters:
terms (Term) – The terms inside the tuple.
Example
>>> X, Y = Ty("X"), Ty("Y") >>> x, y = Variable("x", X), Variable("y", Y) >>> assert Tuple(x, y).cod == X * Y >>> assert Tuple(x, Tuple(y, x)).cod == X * (Y * X) >>> assert Tuple().cod == Ty()
- property name#
The term as printed, computed once from its parts when first read.
- property constants#
The constants of the term, in order of occurrence.