Permutations: Difference between revisions
Content added Content deleted
(→{{header|Python}}: Added a functional definition of permutations, in terms of reduce and concatMap) |
(→Functional Python: Shed one pair of redundant brackets) |
||
Line 5,176: | Line 5,176: | ||
lambda a, x: concatMap( |
lambda a, x: concatMap( |
||
lambda xs: ( |
lambda xs: ( |
||
xs[0:n] + [x] + xs[n:] for n in range(0, 1 + len(xs))) |
|||
) |
|||
)(a), |
)(a), |
||
xs, [[]] |
xs, [[]] |