Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
perms [] = []
perms [x] = [pure x]
perms k@(z:zs) = do
(ls,rs) <-
splitAt
<$> [ 0 .. length zs ]
<*> perms zs
pure (ls ++ [z] ++ rs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment