K

A brief interlude, in which I discuss something that has, frankly, blown my mind today.

If you want to get a job in the finance world coming from IT, it would pay well to learn K, a programming language as concise as it is targeted at doing maths very damn well. To provide an example here, the following code:

(!R)@&{&/x!/:2_!x}'!R

is all that is necessary to list all the prime numbers between 1 and R, the argument to the function. Try doing that in your programming language of choice in even twice as many characters. From all I’ve heard, the interpreter is extremely fast as well

The particular application that has made this popular is KDB, a database that strikes out from the traditional RMDB-SQL world. The primer is a good introduction to K, through its query-targeted subset ‘q’. Now, pardon me while my mind tries to wrap itself around a whole new way of thinking and coding.

Now we return you to our regularly scheduled programming.

2 Replies to “K”

  1. haha, big O… haven’t done that analysis in a while. I’m just taking the example from the wikipedia page (here). Not sure if it’s O(n/2) – looks more like O(n), or O(n log n), to me, if you read the breakdown.

    Something a little different, in any case. KDB is quite popular in the industry now apparently, particularly for high volume data.

Leave a Reply