Skip to content

OrderedSetPartitions() fails for the empty set #35654

@maxale

Description

@maxale

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.

Did you read the documentation and troubleshoot guide?

  • I have read the documentation and troubleshoot guide

Environment

- **OS**: Ubuntu 22.04
- **Sage Version**: 9.8.rc0

Steps To Reproduce

OrderedSetPartitions() well supports parts of zero size.
For example, OrderedSetPartitions({1,2},[1,1,0,0]).list() gives:

[[{1}, {2}, {}, {}], [{2}, {1}, {}, {}]]

However, it does not work when the input set is empty.

Expected Behavior

For example, calling OrderedSetPartitions(set(),[0,0,0]).list() should produce the partition of the empty set into empty (sub)sets:

[[{}, {}, {}]]

Actual Behavior

However, at the moment it results in the error:

IndexError: list index out of range

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions