Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- | Main entry point to the application.
- module Main where
- gerarListaCombinacoes :: Int -> Int -> [[Int]]
- gerarListaCombinacoes n 0 = [[]]
- gerarListaCombinacoes n k | n < k = [[]]
- |otherwise = [(x:xs) | x <- [0..n-1], xs <- (gerarListaCombinacoes n (k-1)), x <= (head xs)]
- filtraCombinacoes :: [[Int]] ->[[Int]]
- filtraCombinacoes (l:ls) = [filtraPares l ] ++ filtraCombinacoes ls
- filtraPares :: [Int] -> [Int]
- filtraPares [] = []
- main :: IO()
- main = do
- print $ gerarListaCombinacoes 4 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement