Function#
- class discopy.python.additive.Function(inside, dom, cod, is_swap_of=None)[source]#
Bases:
discopy.python.function.Function
Python functions with disjoint union as tensor.
- Parameters:
inside (Callable) – The callable Python object inside the function.
dom (type) – The domain of the function, i.e. its list of input types.
cod (type) – The codomain of the function, i.e. its list of output types.
Summary
- ty_factory#
alias of
tuple
[type
, …]
- static swap(x, y)[source]#
Swap the tags of a disjoint union from x + y to y + x.
- Parameters:
x (tuple[type, ...]) – The tuple of types on the left.
y (tuple[type, ...]) – The tuple of types on the right.
- Return type:
- trace(n=1, left=False)[source]#
The additive trace of a function.
- Parameters:
n – The number of types to trace over.
- braid(y)#
Swap the tags of a disjoint union from x + y to y + x.
- Parameters:
x (tuple[type, ...]) – The tuple of types on the left.
y (tuple[type, ...]) – The tuple of types on the right.
- Return type: