News for hackers. Stuff that matters.
Re:KX Systems (KDB/k/q) overhauls its website by darrellsilver on Sunday January 06, 2013 @11:32PM (#5019354)
Can't say I've ever really found a personal use, but in my StatArb days it was invaluable.

Want to calculate the 180 day rolling VWAP only between noon and 2pm for every NYSE stock? Yeah, there's a function for that.

Also, it's a hilariously illegible language, and most anyone who's proficient at it is as nutty (and brilliant) as Arthur ( http://en.wikipedia.org/wiki/Arthur_Whitney_(computer_scient... ), the founder of the company.

Re:KX Systems (KDB/k/q) overhauls its website by olympus on Monday January 07, 2013 @12:31AM (#5019549)
Holy crap. Looking at examples from the wikipedia page: http://en.wikipedia.org/wiki/K_(programming_language)

The following expression sorts a list of strings by their lengths:

x@>#:'x

A function to determine if a number is prime can be written as:

{&/x!/:2_!x}

This looks like brainfuck's cousin, but I'll bet Perl users feel right at home. Edit: I'm not trying to make fun of Perl or anything, it's just that I've seen some really hard to read one liners come out of it as well.

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.
Re:KX Systems (KDB/k/q) overhauls its website by necubi on Monday January 07, 2013 @02:11AM (#5019845)
And K isn't nearly as bad as its predecessor APL [0], which makes extensive use of non-ASCII characters to bring even greater compactness.

For example, the Game of Life in APL is

    life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}
[0] http://en.wikipedia.org/wiki/APL_(programming_language)