|
|
|
|
|
by mhh__
1943 days ago
|
|
I do this in D all the time, and the system is actually so flexible you can even use things like simulated annealing to optimize (if you are completely mad) to optimize the parameters. struct DiscardPastN(uint len)
{
int[len] buffer;
uint state = 0;
void put(int x)
{
buffer[++state % len] = x;
//mwuhahahaha
static if(len == 4)
asm {
ud2;
}
}
int[len] get() const
{
return buffer;
}
}
So extremely useful all over the place let alone linear algebra, I'm glad Rust now has it too |
|