| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.100.1/docs/handbook/_sources/libraries/partitions.rst.txt |
.. _library_partitions:
partitionsThis library provides predicates for generating and querying set partitions of lists. A set partition divides a list into non-empty, non-overlapping blocks whose union is the original list. The following categories of predicates are provided:
default or lexicographic) for controlling output
order.Base predicates are position-sensitive, matching the existing combinatorics libraries. Inputs with repeated values can therefore yield duplicate-valued partitions. Distinct predicates collapse those equal-valued results.
The lexicographic stepping predicates operate on the distinct partition view, using the same canonical block ordering as the distinct generation predicates.
The counting predicates are connected to Bell numbers (for all partitions of an N-element list) and Stirling numbers of the second kind (for partitions with an exact number of blocks).
Dedicated arrangements, cartesian_products, combinations,
derangements, multisets, permutations, and subsequences
libraries are also available for focused APIs on related operations.
Open the `../../apis/library_index.html#partitions <../../apis/library_index.html#partitions>`__ link in a web browser.
To load all entities in this library, load the loader.lgt file:
::
| ?- logtalk_load(partitions(loader)).
To test this library predicates, load the tester.lgt file:
::
| ?- logtalk_load(partitions(tester)).