Permutations: Difference between revisions
Content added Content deleted
m (→{{header|C sharp|C#}}: Removed minor ) syntax problem, and this code not works whatever, because T and T cannot be compared.) |
|||
Line 1,610: | Line 1,610: | ||
if (values.Count() == 1) |
if (values.Count() == 1) |
||
return new [] {values}; |
return new [] {values}; |
||
return values.SelectMany(v => Permutations(values.Where(x=> x != v |
return values.SelectMany(v => Permutations(values.Where(x=> x != v)),(v, p) => p.Prepend(v)); |
||
}</lang> |
}</lang> |
||
Usage |
Usage |