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
// Stuff needed to make C# a kind of cluttered subtyping Haskell: | |
// - Higher kinded polymorphism (being able to pass Generic Type Definitions as type parameters) | |
// - Static interfaces & static abstract types (this gets quite perverse at the CLR level) | |
// - GADTS (easily implemented as syntactic sugar) | |
namespace HKP { | |
public static A<B> Create<A, B>() where A : <>, new() { | |
return new A<B>(); // Can't do a whole lot of useful things here, since we know little about TFn | |
} | |
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
const int KeysMax = 1024 * 1024; // 1MB | |
const int ValueLength = 4096; // 4KB | |
// using a jagged array. Note that the same arguments apply to algebraic arrays, though they are not as severe | |
byte[][] goodLut = new byte[KeysMax][]; | |
for(int i = 0; i < KeysMax; i++) { | |
goodLut[i] = new int[ValueLength]; | |
} | |
byte[][] badLut = new byte[ValueLength][]; |