Copyright | © Frank Jung 2020 |
---|---|
License | GPL-3 |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Permutation
Description
From the book Algorithm Design with Haskell by R. Bird and J. Gibbons.
Documentation
inserts :: a -> [a] -> [[a]] Source #
Insert character into list at each location.
Example:
>>>
inserts 'a' "bc"
["abc","bac","bca"]
perms1 :: [a] -> [[a]] Source #
Generate permutations using list comprehensions.
Example:
>>>
perms1 "abc"
["abc","bac","bca","acb","cab","cba"]