私はサブルーチンを持っています:
private static IEnumerable<IEnumerable<T>> permutations<T>(IEnumerable<T> source)
{
var c = source.Count();
if (c == 1)
yield return source;
else
for (int i = 0; i < c; i++)
foreach (var p in permutations(source.Take(i).Concat(source.Skip(i + 1))))
yield return source.Skip(i).Take(1).Concat(p);
}
それでは、main関数でそれを呼び出す方法は?
static void Main(string[] args)
{
string input = "abcdefghijk";
IEnumerable<string> summary;
summary= permutations<string>(IEnumerable<string> input);// obviously wrong, but how??
}