Last active
November 15, 2018 10:18
-
-
Save clojj/738dd4a43c8f89f3247eaceca21b11b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
permutations :: (Eq a) => [a] -> [[a]] | |
permutations [] = [[]] | |
permutations l = [a:x | a <- l, x <- (permutate $ filter (\x -> x /= a) l)] | |
allUnique :: Eq a => [a] -> Bool | |
allUnique [] = True | |
allUnique ls = and [r | x <- ls, r <- [length (filter (\e -> e /= x) ls) == (length ls) - 1]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment