>>> import Data.List >>> permutations [1,2,3] [[1,2,3],[2,1,3],[3,2,1],[2,3,1],[3,1,2],[1,3,2]] comb :: Int -> [a] -> [[a]] comb 0 xs = [[]] comb _ [] = [] comb n (x:xs) = [x:y | y <- comb (n-1) xs] ++ comb n xs >>> import Control.Monad >>> replicateM 5 ["a", "b", "c"] [["a","a","a","a","a"],["a","a","a","a","b"],["a","a","a","a","c"],["a","a","a","b","a"],["a","a","a","b","b"],["a","a","a","b","c
{{#tags}}- {{label}}
{{/tags}}