## Combination of k items taken n at a time

June 22, 2020

```
-- combo.hs
-- problem: C(k,n), where k = the integers from 1 to 9, inclusive
-- and n = 3, without regard to order, then sum the subsets
module Combo where
import Data.List
combinations 0 lst = [[]]
combinations n lst = do
(x:xs) <- tails lst
rest <- combinations (n-1) xs
return $ x : rest
result = ( map sum (combinations 3 [1..9]))
```