6 ms·
https://en.wikipedia.org/wiki/K_(programming_language) https://en.wikipedia.org/wiki/K_(programming_language)
by Gys 4y ago
https://en.wikipedia.org/wiki/K_(programming_language) https://en.wikipedia.org/wiki/K_(programming_language)
- sergiotapia 4y agoThat has to be the tersest language I have ever seen in my life. Code golf but it's actually a real language used heavily in finance.
- dan-robertson 4y agoI think ‘used heavily’ is a bit of an overstatement. I think the right intuition for APL-family languages is that they mostly do numpy-like operations except their set of operations tend to compose very nicely. So the idea is that one can quickly and interactively figure out a composition of the operations which will do the calculation you want, but you don’t have a complicated compiler and spend most of your time in the operators rather than the interpreted language, and the operators tend to make the cpu happy – they work on contiguous memory, tend to be vectorized, don’t branch unpredictably, etc – so even if you have to compose many steps, you win on the time to write and the time to execute can be hard to beat because the constant factors of each individual operation are good. For obvious reasons, things like numpy, pandas, dplyr, etc are more popular as their syntax is a bit more readable and it is easier to get data in/out. I think they do lose a bit by not having lots of the useful compostable APL-style operators because those things don’t have comprehensible names.
- rippercushions 4y ago> compostable APL-style operators APL-style operators have been sent to the compost heap of history for a reason.
- dan-robertson 4y agoFold Scan Map Head/tail Index (with an array) The integers up to n Concatenate Flatten Most of the operators are already familiar but they tend to work well on multidimensional arrays and with each other due to broadcast semantics (and some axis selection features). In other languages you may see the magic broadcasting for some operations like addition but many of the functions only work on vectors.
- eismcc 4y agoI wrote http://KlongPy.org http://KlongPy.org to blend Klong and python. Eat your cake and have it too :)
- therein 4y agoSome exchanges like BitMEX are written in kdb+, as in, the trade engine.
- dan-robertson 4y agoWhat is a trade engine?
- mandevil 4y agoThe actual thing that lines up a series of sell-at-this-price bids and the series of buy-at-this-price bids (or even more complicated types of orders, this the easy case) and crosses them over, figuring out who gets what bids filled by whom at what price, at supremely fast speeds and large volumes.
- dan-robertson 4y agoI think I’ve only heard of such a component referred to as a matching engine.
- therein 4y agoI've heard it both ways. Now you have as well, so next time you see it, you won't need someone to explain it to you.
- dan-robertson 4y agoI did try looking it up fwiw. That was my guess but I was wondering if you meant something else and didn’t want to jump to conclusions. I was surprised by the suggestion that kdb+ was used for this because a matching engine doesn’t really sound like the kind of case that APL-family languages would be well suited to – they tend to work well on large batches of data but for a matching engine, you have messages that come in over time and you want to process each message with reliable low latency (if you have higher latencies you will get wider spreads which is a competitive risk and leads to collecting less in fees), which means not operating on batches. Do you have a source for the claim that kdb+ is used for the matching engine?
- namuol 4y agoMost of the time when you open a PL article on Wikipedia you're greeted with a Hello World example, but here you get this: """ [...] As a result, K expressions can be opaque and difficult to parse for humans. For example, in the following contrived expression the exclamation point ! refers to three distinct functions: 2!!7!4 Reading from right to left the first ! is modulo division that is performed on 7 and 4 resulting in 3. The next ! is enumeration and lists the integers less than 3, resulting in the list 0 1 2. The final ! is rotation where the list on the right is rotated two times to the left producing the final result of 2 0 1. """