順列の組み合わせだけでも・・・
最初、gtlt さんに、教えて頂いた順列のコード
const permutation = (function (map) (function (r, m, i, o) (o.length < 2) ? o : r.concat (o.slice (0, i) .concat (o.slice (i + 1)) .reduce (arguments.callee, []) .map (map, [m])))) (function (q) this.concat (q));
その後。
var permutation = function (result, arg, index, args) { return (args.length < 2) ? args : result.concat (args.slice (0, index) .concat (args.slice (index + 1)) .reduce (permutation, [ ]) .map (function (m) { return [arg].concat (m); })); };
で、自作。スパイスが決め手!じゃなかった Array.splice 。でも、引数(o)のコピーに Array.slice(0) を使う。全然だめだ。
洗練されていない!
const permutation = (function (map) (function (r, m, i, o) (o.length < 2) ? o : let(p=o.slice(0)) (p.splice (i, 1), r.concat (p.reduce (arguments.callee, []).map (map, [m]))))) (function (m) this.concat (m));
四たび、熟考。& zzzzz.....