Enumerated set of lists of integers with constraints: front-end#

  • IntegerLists: class which models an enumerated set of lists of integers with certain constraints. This is a Python front-end where all user-accessible functionality should be implemented.

class sage.combinat.integer_lists.lists.IntegerList#

Bases: sage.structure.list_clone.ClonableArray

Element class for IntegerLists.


Check to make sure this is a valid element in its IntegerLists parent.


sage: C = IntegerListsLex(4)
sage: C([4]).check()
sage: C([5]).check()
class sage.combinat.integer_lists.lists.IntegerLists(*args, **kwds)#

Bases: sage.structure.parent.Parent

Enumerated set of lists of integers with constraints.

Currently, this is simply an abstract base class which should not be used by itself. See IntegerListsLex for a class which can be used by end users.

IntegerLists is just a Python front-end, acting as a Parent, supporting element classes and so on. The attribute .backend which is an instance of sage.combinat.integer_lists.base.IntegerListsBackend is the Cython back-end which implements all operations such as iteration.

The front-end (i.e. this class) and the back-end are supposed to be orthogonal: there is no imposed correspondence between front-ends and back-ends.

For example, the set of partitions of 5 and the set of weakly decreasing sequences which sum to 5 might be implemented by the same back-end, but they will be presented to the user by a different front-end.


sage: from sage.combinat.integer_lists import IntegerLists
sage: L = IntegerLists(5)
sage: L
Integer lists of sum 5 satisfying certain constraints

sage: IntegerListsLex(2, length=3, name="A given name")
A given name

alias of IntegerList


alias of sage.combinat.integer_lists.base.IntegerListsBackend