← Back to context

Comment by Thorrez

5 years ago

Doesn't seem that strange compared to K[1] or Q[2], which are used by Wall Street banks. K encourages you to use single-letter variables and bunch your code up as tight as possible into long lines. Here's an example: [3]. Interestingly, their Github repo has some K-inspired C[4], Java[5], C#[6], and Javascript[7].

[1] https://en.wikipedia.org/wiki/K_(programming_language)

[2] https://en.wikipedia.org/wiki/Q_(programming_language_from_K...

[3] https://github.com/KxSystems/kdb/blob/master/holiday.q

[4] https://github.com/KxSystems/kdb/blob/master/c/c/odbc.c

[5] https://github.com/KxSystems/kdb/blob/master/c/jdbc.java

[6] https://github.com/KxSystems/kdb/blob/master/c/c.cs

[7] https://github.com/KxSystems/kdb/blob/master/c/c.js

Thank you. Now when I'm thinking some code I have to untangle is bad, I'd always remind myself "at least it's not K-inspired C"...

  • This took me a while to figure out but K/APL code is built on a different value system than most software. Specifically, the goal is to be able to see and operate on the entire program at once. Obviously this only works for programs up to a certain size but that size is larger than you'd expect when abstractions, variable names, and general legibility are sacrificed. I wouldn't write code this way but I can see how someone would find it valuable.

The big banks don't write code in K4 though, managers generally encourage people not to write code in it due to the difficulty of finding developers who are fluent in it.

They all use q and q is very wordy and highly readable if you speak english. It's mostly just developer defined functions which are compositions of the keywords of which there are not many: https://code.kx.com/q/ref/#keywords

Most of the code you would see in a kdb+ system in an investment bank won't look like any of the links you've provided.

  • Do you have any suggestions for q code to look at? Every time I try array languages I bounce off the ubercompact and I feel like there's actually a chance I could learn something more q like.

Very interesting.

I am feeling the urge to learn array processing languages.

There is something very tempting.

  • Project Euler frequently has ultra-short solutions in K/J/whatever other single letter they’re using at the moment. It is quite intriguing, but ultimately I put too much store in readability, so decided not to pursue these.