Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. import Data.List (delete)
  2.  
  3. kSublistPermutations :: Eq a => Int -> [a] -> [[a]]
  4. kSublistPermutations 0 _ = []
  5. kSublistPermutations 1 xs = map (\x -> [x]) $ xs
  6. kSublistPermutations k xs = concatMap f xs where
  7. f x = map (x :) $ kSublistPermutations (k-1) $ delete x xs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement