# PartitionsAndPermutations¶

PartitionsAndPermutations contains functions for generating streams of integer partitions, and streams of sequences of integers composed from a multi-set.

conjugate: List Integer -> List Integer

`conjugate(pt)` is the conjugate of the partition `pt`.

conjugates: Stream List Integer -> Stream List Integer

`conjugates(lp)` is the stream of conjugates of a stream of partitions `lp`.

distinct_partitions: (Integer, Integer, Integer) -> Stream List Integer

`distinct_partitions(p, l, n)` is the stream of partitions of `n` into distinct numbers whose number of parts is no greater than `p` and whose largest part is no greater than `l`.

distinct_partitions: Integer -> Stream List Integer

`distinct_partitions(n)` is the stream of all partitions of `n` into distinct numbers.

odd_partitions: (Integer, Integer, Integer) -> Stream List Integer

`odd_partitions(p, l, n)` is the stream of partitions of `n` into odd numbers whose number of parts is no greater than `p` and whose largest part is no greater than `l`.

odd_partitions: Integer -> Stream List Integer

`odd_partitions(n)` is the stream of all partitions of `n` into odd numbers.

partitions: (Integer, Integer) -> Stream List Integer

`partitions(p, l)` is the stream of all partitions whose number of parts and largest part are no greater than `p` and `l`.

partitions: (Integer, Integer, Integer) -> Stream List Integer

`partitions(p, l, n)` is the stream of partitions of `n` whose number of parts is no greater than `p` and whose largest part is no greater than `l`.

partitions: Integer -> Stream List Integer

`partitions(n)` is the stream of all partitions of `n`.

permutations: Integer -> Stream List Integer

`permutations(n)` is the stream of permutations formed from `1, 2, 3, ..., n`.

sequences: (List Integer, List Integer) -> Stream List Integer

`sequences(l1, l2)` is the stream of all sequences that can be composed from the multiset defined from two lists of integers `l1` and `l2`. For example, the pair `([1, 2, 4], [2, 3, 5])` represents multi-set with 1 `2`, 2 `3``'s`, and 4 `5``'s`.

sequences: List Integer -> Stream List Integer

`sequences([l0, l1, l2, .., ln])` is the set of all sequences formed from `l0` 0`'s`, `l1` 1`'s`, `l2` 2`'s`, …, `ln` `n``'s`.

shuffle: (List Integer, List Integer) -> Stream List Integer

`shuffle(l1, l2)` forms the stream of all shuffles of `l1` and `l2`, i.e. all sequences that can be formed from merging `l1` and `l2`.

shufflein: (List Integer, Stream List Integer) -> Stream List Integer

`shufflein(l, st)` maps shuffle(`l`, `u`) on to all members `u` of st, concatenating the results.