Permutations: Difference between revisions
→ES6
(→ES6) |
(→ES6) |
||
Line 2,362:
'use strict';
let permutations = (xs) => xs.length ? (▼
permutations(del(x, xs))), xs)▼
flatMap = (f, xs) => [].concat.apply([], xs.map(f)),
▲ let permutations = (xs) =>
xs.length ? (concatMap(▼
▲ ys => [[x].concat(ys)],
▲ permutations(
▲ ), xs)) : [[]],
) : [xs[0]].concat(
return permutations(lst);
})([
|