Copyright | (c) Eric Bailey 2024-2025 |
---|---|
License | MIT |
Maintainer | eric@ericb.me |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Data.Rhythm.Partitions
Description
Integer partitions, i.e., representations of integers as a sum of positive integers where the order of the summands is not significant.
Synopsis
- partitions :: Int -> [Partition]
- partitionsAllowed :: Foldable t => t Int -> Int -> [Partition]
- partitionsLength :: Int -> Int -> [Partition]
- partitionsLengthAllowed :: Foldable t => Int -> t Int -> Int -> [Partition]
Documentation
partitions :: Int -> [Partition] Source #
Partitions of a given number.
>>>
partitions 3
[Partition [1,1,1],Partition [2,1],Partition [3]]
partitionsAllowed :: Foldable t => t Int -> Int -> [Partition] Source #
Partitions with allowed parts.
>>>
partitionsAllowed [1,2,3] 4
[Partition [1,1,1,1],Partition [2,1,1],Partition [2,2],Partition [3,1]]