module Math.Combinat.Sets
( kSublists
, sublists
, countKSublists
, countSublists
)
where
import Math.Combinat.Helper
kSublists :: Int -> [a] -> [[a]]
kSublists 0 _ = [[]]
kSublists k [] = []
kSublists k (x:xs) = map (x:) (kSublists (k1) xs) ++ kSublists k xs
countKSublists :: Int -> Int -> Integer
countKSublists k n = binomial (fromIntegral n) (fromIntegral k)
sublists :: [a] -> [[a]]
sublists [] = [[]]
sublists (x:xs) = map (x:) (sublists xs) ++ sublists xs
countSublists :: Int -> Integer
countSublists n = 2 ^ n