How to improve server performance
[via donncha]
I’ve been working in KDB fairly frequently on my current project. Today, I had some time on my lunch break to figure out how to use it to write a basic prefix interpreter. I wanted to keep it to one anonymous expression, which meant that I couldn’t use explicit recursion. I also wanted to make it as compact as possible. Here’s the result:
{{x[{(y[x;y])[z]}[x;y]]}[x;{x[{(y[x;y])[z]}[x;y]]}]}[{$[y~();();$[-11h=type y;({{x[{(y[x;y])[z]}[x;y]]}[x;{x[{(y[x;y])[z]}[x;y]]}]}[{$[z~();(exit[0];-1 string y);$[y in key z 0;(z 0) y;(x[y])[z 1]]]}][y])[z];$[0<>type y;y;.[x[y[0]][z];{(x[z])[y]}[x;z] each 1 _ y]]]]}]
Read the rest of this entry »