News for hackers. Stuff that matters.
Re:KX Systems (KDB/k/q) overhauls its website by tlack on Monday January 07, 2013 @02:21AM (#5019866)
Like everything else in our business, it seems harder at first glance than it really is. It's a powerful language and like many powerful things it takes a while to learn. For instance here's my really rough I've-forgotten-most-of-K translation of that first snippet:

    x@>#:'x
Read from right to left:

    :'x
means apply the function/operator to the left of the : to each item of x (the default first parameter to a function is called simply x - big time saver)

    #:'x
means the length of each item of x, and adding the sorting function:

    > 
means sort the items and return the indices the items would have if they were in ascending order. Finally:

    @
is just the indexing operator (as you'd kind of expect when saying 'at'), so the whole line means: return the elements of x after sorting them by their length.

There are no comments on this comment yet.