3 ms·
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
by darrellsilver 14y ago
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_scientist) http://en.wikipedia.org/wiki/Arthur_Whitney_(computer_scient... ), the founder of the company.
- olympus 14y agoHoly crap. Looking at examples from the wikipedia page: http://en.wikipedia.org/wiki/K_(programming_language) 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.
- necubi 14y agoAnd 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) http://en.wikipedia.org/wiki/APL_(programming_language)
- tlack 14y agoLike 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.