protocol
integer_partitions_protocol
Protocol for integer partition operations.
logtalk_load(integer_partitions(loader))staticPublic predicates
partitions/2
Generates all partitions of a non-negative integer using default order. Partitions are represented as non-increasing lists of positive integers that sum to the given integer. Zero has one partition, represented by the empty list of parts.
staticpartitions(N,Partitions)partitions(+non_negative_integer,-list) - onepartition/2
True iff the second argument is a partition of a non-negative integer using default order.
staticpartition(N,Partition)partition(+non_negative_integer,-list) - one_or_morepartitions/3
Generates either all partitions of an integer with the given order (when the second argument is default or lexicographic) or all partitions with an exact number of parts using default order (when the second argument is an integer). Note that, unlike the partitions library (where the size constraint can occupy the first argument position, distinguishing it from a list by type), here the integer being partitioned and the exact part count are both integers, so the part count is always given as the second argument, distinguished from the order by type.
staticpartitions(N,KOrOrder,Partitions)partitions(+non_negative_integer,+atom,-list) - onepartitions(+non_negative_integer,+non_negative_integer,-list) - onepartition/3
True iff the third argument is a partition generated either in the given order or with the given exact number of parts using default order.
staticpartition(N,KOrOrder,Partition)partition(+non_negative_integer,+atom,-list) - one_or_morepartition(+non_negative_integer,+non_negative_integer,-list) - one_or_morepartitions/4
Generates all partitions of an integer with an exact number of parts and the given order: default or lexicographic.
staticpartitions(N,K,Order,Partitions)partitions(+non_negative_integer,+non_negative_integer,+atom,-list) - onepartition/4
True iff the fourth argument is a partition with an exact number of parts and the given order: default or lexicographic.
staticpartition(N,K,Order,Partition)partition(+non_negative_integer,+non_negative_integer,+atom,-list) - one_or_moredistinct_partitions/2
Generates all partitions of a non-negative integer into distinct (non-repeating) parts using default order. Unlike the partitions library, where “distinct” deduplicates equal-valued results from a position-sensitive generator, an integer partition has no position-sensitive input to begin with; here “distinct” is the standard integer partition notion of parts that are pairwise different (also known as strict partitions).
staticdistinct_partitions(N,Partitions)distinct_partitions(+non_negative_integer,-list) - onedistinct_partition/2
True iff the second argument is a partition of a non-negative integer into distinct parts using default order.
staticdistinct_partition(N,Partition)distinct_partition(+non_negative_integer,-list) - one_or_moredistinct_partitions/3
Generates either all partitions into distinct parts with the given order (when the second argument is default or lexicographic) or all partitions into an exact number of distinct parts using default order (when the second argument is an integer).
staticdistinct_partitions(N,KOrOrder,Partitions)distinct_partitions(+non_negative_integer,+atom,-list) - onedistinct_partitions(+non_negative_integer,+non_negative_integer,-list) - onedistinct_partition/3
True iff the third argument is a partition into distinct parts generated either in the given order or with the given exact number of parts using default order.
staticdistinct_partition(N,KOrOrder,Partition)distinct_partition(+non_negative_integer,+atom,-list) - one_or_moredistinct_partition(+non_negative_integer,+non_negative_integer,-list) - one_or_moredistinct_partitions/4
Generates all partitions of an integer into an exact number of distinct parts and the given order: default or lexicographic.
staticdistinct_partitions(N,K,Order,Partitions)distinct_partitions(+non_negative_integer,+non_negative_integer,+atom,-list) - onedistinct_partition/4
True iff the fourth argument is a partition into an exact number of distinct parts and the given order: default or lexicographic.
staticdistinct_partition(N,K,Order,Partition)distinct_partition(+non_negative_integer,+non_negative_integer,+atom,-list) - one_or_morecount_partitions/2
Counts the number of partitions of a non-negative integer.
staticcount_partitions(N,Count)count_partitions(+non_negative_integer,-non_negative_integer) - onecount_partitions/3
Counts the number of partitions of a non-negative integer with an exact number of parts.
staticcount_partitions(N,K,Count)count_partitions(+non_negative_integer,+non_negative_integer,-non_negative_integer) - zero_or_onecount_distinct_partitions/2
Counts the number of partitions of a non-negative integer into distinct parts.
staticcount_distinct_partitions(N,Count)count_distinct_partitions(+non_negative_integer,-non_negative_integer) - onecount_distinct_partitions/3
Counts the number of partitions of a non-negative integer into an exact number of distinct parts.
staticcount_distinct_partitions(N,K,Count)count_distinct_partitions(+non_negative_integer,+non_negative_integer,-non_negative_integer) - zero_or_onenth_partition/3
Returns the partition at a given zero-based index using default order.
staticnth_partition(N,Index,Partition)nth_partition(+non_negative_integer,+integer,-list) - zero_or_onenth_partition/4
Returns either the partition at a given zero-based index in the given order (when the second argument is default or lexicographic) or the partition with an exact number of parts at a given zero-based index using default order (when the second argument is an integer).
staticnth_partition(N,KOrOrder,Index,Partition)nth_partition(+non_negative_integer,+atom,+integer,-list) - zero_or_onenth_partition(+non_negative_integer,+non_negative_integer,+integer,-list) - zero_or_onenth_partition/5
Returns the partition with an exact number of parts at a given zero-based index in the given order: default or lexicographic.
staticnth_partition(N,K,Order,Index,Partition)nth_partition(+non_negative_integer,+non_negative_integer,+atom,+integer,-list) - zero_or_onepartition_index/3
Returns the zero-based index of a partition using default order.
staticpartition_index(N,Partition,Index)partition_index(+non_negative_integer,+list,-integer) - zero_or_onepartition_index/4
Returns either the zero-based index of a partition in the given order (when the second argument is default or lexicographic) or the zero-based index of a partition with an exact number of parts using default order (when the second argument is an integer).
staticpartition_index(N,KOrOrder,Partition,Index)partition_index(+non_negative_integer,+atom,+list,-integer) - zero_or_onepartition_index(+non_negative_integer,+non_negative_integer,+list,-integer) - zero_or_onepartition_index/5
Returns the zero-based index of a partition with an exact number of parts in the given order: default or lexicographic.
staticpartition_index(N,K,Order,Partition,Index)partition_index(+non_negative_integer,+non_negative_integer,+atom,+list,-integer) - zero_or_onenth_distinct_partition/3
Returns the partition into distinct parts at a given zero-based index using default order.
staticnth_distinct_partition(N,Index,Partition)nth_distinct_partition(+non_negative_integer,+integer,-list) - zero_or_onenth_distinct_partition/4
Returns either the partition into distinct parts at a given zero-based index in the given order (when the second argument is default or lexicographic) or the partition with an exact number of distinct parts at a given zero-based index using default order (when the second argument is an integer).
staticnth_distinct_partition(N,KOrOrder,Index,Partition)nth_distinct_partition(+non_negative_integer,+atom,+integer,-list) - zero_or_onenth_distinct_partition(+non_negative_integer,+non_negative_integer,+integer,-list) - zero_or_onenth_distinct_partition/5
Returns the partition with an exact number of distinct parts at a given zero-based index in the given order: default or lexicographic.
staticnth_distinct_partition(N,K,Order,Index,Partition)nth_distinct_partition(+non_negative_integer,+non_negative_integer,+atom,+integer,-list) - zero_or_onedistinct_partition_index/3
Returns the zero-based index of a partition into distinct parts using default order.
staticdistinct_partition_index(N,Partition,Index)distinct_partition_index(+non_negative_integer,+list,-integer) - zero_or_onedistinct_partition_index/4
Returns either the zero-based index of a partition into distinct parts in the given order (when the second argument is default or lexicographic) or the zero-based index of a partition with an exact number of distinct parts using default order (when the second argument is an integer).
staticdistinct_partition_index(N,KOrOrder,Partition,Index)distinct_partition_index(+non_negative_integer,+atom,+list,-integer) - zero_or_onedistinct_partition_index(+non_negative_integer,+non_negative_integer,+list,-integer) - zero_or_onedistinct_partition_index/5
Returns the zero-based index of a partition with an exact number of distinct parts in the given order: default or lexicographic.
staticdistinct_partition_index(N,K,Order,Partition,Index)distinct_partition_index(+non_negative_integer,+non_negative_integer,+atom,+list,-integer) - zero_or_onerandom_partition/2
Returns a random partition of a non-negative integer.
staticrandom_partition(N,Partition)random_partition(+non_negative_integer,-list) - onerandom_partition/3
Returns a random partition of a non-negative integer with an exact number of parts.
staticrandom_partition(N,K,Partition)random_partition(+non_negative_integer,+non_negative_integer,-list) - zero_or_onesample_partitions/3
Returns SampleCount random partitions of a non-negative integer, sampled with replacement.
staticsample_partitions(N,SampleCount,Samples)sample_partitions(+non_negative_integer,+non_negative_integer,-list) - zero_or_onesample_partitions/4
Returns SampleCount random partitions of a non-negative integer with an exact number of parts, sampled with replacement.
staticsample_partitions(N,K,SampleCount,Samples)sample_partitions(+non_negative_integer,+non_negative_integer,+non_negative_integer,-list) - zero_or_onerandom_distinct_partition/2
Returns a random partition of a non-negative integer into distinct parts.
staticrandom_distinct_partition(N,Partition)random_distinct_partition(+non_negative_integer,-list) - onerandom_distinct_partition/3
Returns a random partition of a non-negative integer with an exact number of distinct parts.
staticrandom_distinct_partition(N,K,Partition)random_distinct_partition(+non_negative_integer,+non_negative_integer,-list) - zero_or_onesample_distinct_partitions/3
Returns SampleCount random partitions of a non-negative integer into distinct parts, sampled with replacement.
staticsample_distinct_partitions(N,SampleCount,Samples)sample_distinct_partitions(+non_negative_integer,+non_negative_integer,-list) - zero_or_onesample_distinct_partitions/4
Returns SampleCount random partitions of a non-negative integer with an exact number of distinct parts, sampled with replacement.
staticsample_distinct_partitions(N,K,SampleCount,Samples)sample_distinct_partitions(+non_negative_integer,+non_negative_integer,+non_negative_integer,-list) - zero_or_onenext_partition/3
Returns the next partition value of a non-negative integer in lexicographic order.
staticnext_partition(N,Partition,Next)next_partition(+non_negative_integer,+list,-list) - zero_or_onenext_partition/4
Returns the next partition value of a non-negative integer with an exact number of parts in lexicographic order.
staticnext_partition(N,K,Partition,Next)next_partition(+non_negative_integer,+non_negative_integer,+list,-list) - zero_or_oneprevious_partition/3
Returns the previous partition value of a non-negative integer in lexicographic order.
staticprevious_partition(N,Partition,Previous)previous_partition(+non_negative_integer,+list,-list) - zero_or_oneprevious_partition/4
Returns the previous partition value of a non-negative integer with an exact number of parts in lexicographic order.
staticprevious_partition(N,K,Partition,Previous)previous_partition(+non_negative_integer,+non_negative_integer,+list,-list) - zero_or_onenext_distinct_partition/3
Returns the next partition-into-distinct-parts value of a non-negative integer in lexicographic order.
staticnext_distinct_partition(N,Partition,Next)next_distinct_partition(+non_negative_integer,+list,-list) - zero_or_onenext_distinct_partition/4
Returns the next partition-into-distinct-parts value of a non-negative integer with an exact number of parts in lexicographic order.
staticnext_distinct_partition(N,K,Partition,Next)next_distinct_partition(+non_negative_integer,+non_negative_integer,+list,-list) - zero_or_oneprevious_distinct_partition/3
Returns the previous partition-into-distinct-parts value of a non-negative integer in lexicographic order.
staticprevious_distinct_partition(N,Partition,Previous)previous_distinct_partition(+non_negative_integer,+list,-list) - zero_or_oneprevious_distinct_partition/4
Returns the previous partition-into-distinct-parts value of a non-negative integer with an exact number of parts in lexicographic order.
staticprevious_distinct_partition(N,K,Partition,Previous)previous_distinct_partition(+non_negative_integer,+non_negative_integer,+list,-list) - zero_or_oneProtected predicates
(none)
Private predicates
(none)
Operators
(none)