Skip to content

Instantly share code, notes, and snippets.

@Tyralion
Created March 21, 2016 15:07
Show Gist options
  • Select an option

  • Save Tyralion/9d2a797ca401189d9362 to your computer and use it in GitHub Desktop.

Select an option

Save Tyralion/9d2a797ca401189d9362 to your computer and use it in GitHub Desktop.
perms [] = [[]]
perms list = let
del x [] = []
del x (y:ys) = if x /= y then y : del x ys else del x ys
in concatMap (\x -> map (x:) $ perms $ del x list ) list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment