Anonymous user
Permutations: Difference between revisions
→{{header|Haskell}}: better
(→{{header|Haskell}}: A serialized version) |
(→{{header|Haskell}}: better) |
||
Line 2,944:
ins :: [a] -> a -> Int -> [a]
ins list x n = listn ++ [x] ++ listn' where (listn,listn')=L.splitAt n list
permutations :: [a] -> [[a]]
permutations s =
foldl (\ac x->
ac >>= (\l->
[[]] s
</lang>
|