List#
- class discopy.monoidal.List(*inside)[source]#
Bases:
discopy.abc.Monoid,discopy.utils.ResultThe free monoid on a
generator_factory, i.e. lists of its instances with concatenation astensor()and the empty list as unit.List[X]is the free monoid onXthe wayHypergraph[C]is the hypergraph category over a categoryC, e.g.python.Function.obisList[type], the free monoid on Python’stype. It has a single, trivial colour:Tyis the free coloured monoid, withColourboundaries on itsWiregenerators, andNatthe free monoid on a single generator.>>> assert List[int](2, 3) @ List[int](4) == List[int](2, 3, 4) >>> assert List[int](2, 3) ** 2 == List[int](2, 3, 2, 3) >>> assert List[int](2, 3)[1:] == List[int](3) and not List[int]()
Note
A list is a sequence of its length-one sublists, e.g.
List[int](2, 3)[0] == List[int](2); the atoms themselves are itsinside, e.g.List[int](2, 3).inside[0] == 2.