Safe Haskell | None |
---|---|
Language | Haskell2010 |
Subsets.
- choose :: Int -> [a] -> [[a]]
- choose_ :: Int -> Int -> [[Int]]
- combine :: Int -> [a] -> [[a]]
- compose :: Int -> [a] -> [[a]]
- tuplesFromList :: Int -> [a] -> [[a]]
- listTensor :: [[a]] -> [[a]]
- kSublists :: Int -> [a] -> [[a]]
- sublists :: [a] -> [[a]]
- countKSublists :: Int -> Int -> Integer
- countSublists :: Int -> Integer
- randomChoice :: RandomGen g => Int -> Int -> g -> ([Int], g)
choices
choose :: Int -> [a] -> [[a]] Source
All possible ways to choose k
elements from a list, without
repetitions. "Antisymmetric power" for lists. Synonym for kSublists
.
choose_ :: Int -> Int -> [[Int]] Source
choose_ k n
returns all possible ways of choosing k
disjoint elements from [1..n]
choose_ k n == choose k [1..n]
combine :: Int -> [a] -> [[a]] Source
All possible ways to choose k
elements from a list, with repetitions.
"Symmetric power" for lists. See also Math.Combinat.Compositions.
TODO: better name?
tensor products
tuplesFromList :: Int -> [a] -> [[a]] Source
"Tensor power" for lists. Special case of listTensor
:
tuplesFromList k xs == listTensor (replicate k xs)
See also Math.Combinat.Tuples. TODO: better name?
listTensor :: [[a]] -> [[a]] Source
"Tensor product" for lists.
sublists
countKSublists :: Int -> Int -> Integer Source
# = binom { n } { k }
.
countSublists :: Int -> Integer Source
# = 2^n
.