This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"syscall" | |
"unsafe" | |
) | |
var ( | |
kernel32 = syscall.NewLazyDLL("kernel32.dll") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Permutations | |
{ | |
public static IEnumerable<IEnumerable<T>> Get<T>(IEnumerable<T> set, IEnumerable<T> subset = null) | |
{ | |
if (subset == null) subset = new T[] { }; | |
if (!set.Any()) yield return subset; | |
for (var i = 0; i < set.Count(); i++) | |
{ | |
var newSubset = set.Take(i).Concat(set.Skip(i + 1)); |