Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- perms [] = [[]]
- perms (x:xs) = concat.(map $ \list -> inject x list) $ perms xs
- where
- inject x list = map (\p -> (take p list) ++ [x] ++ (drop p list)) [0..last]
- where
- last = length list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement