Skip to content

Instantly share code, notes, and snippets.

@redswallow
Last active December 26, 2015 19:59
Show Gist options
  • Save redswallow/7205408 to your computer and use it in GitHub Desktop.
Save redswallow/7205408 to your computer and use it in GitHub Desktop.
combinations [] = [[]]
combinations (x:xs) = map (x:) (combs xs) ++ combs xs
Haskell code snippets
remove x list= [n|n<-list,n/=x]
permutations [] = [[]]
permutations xs = [x:ps | x <- xs, ps <- permutations (remove x xs)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment