5 ms·
I use to program financial applications in K/Q for a stint. Very elegant and orthogonal language. And very well documented. One major issue I had with it and ot
by snicker7 7y ago
I use to program financial applications in K/Q for a stint. Very elegant and orthogonal language. And very well documented. One major issue I had with it and other APL-ish languages: lack of skimmability.
I can easily skim thousands of lines of Perl and Java in seconds and have a rough idea of what the code does. Reading K, however, requires careful and deliberate attention to every single character. I found it useful to maintain documentation on how to /read/ the code (almost a literate programming approach).
- BiteCode_dev 7y agoThat's bad in my book. I write a line once for a 100 times I read it.
- Roboprog 7y agoOTOH, there is something to be said for reading fewer lines in some cases. Conifer forest Vs Pine Pine Cedar Spruce Pine Cedar ...
- threatofrain 7y agoIsn't Lisp that Conifer forest.
- oddthink 7y agoYeah, I agree. I wrote some mortgage prepayment models in q for a while, but didn't dip into K itself. Q is fantastic as a database query language (assuming you have time-series databases and are mostly doing fairly simple operations.) Implementing a full model in it is fine, but can get hard to maintain. Also it has (or had, maybe they fixed it) a bunch of weird quirks, like "sum foo" skipping all the NAs in a list while "+/foo" didn't, resulting in NaN. (Or maybe it was +/ over an int array didn't work while a double array did. I forget.) Arrays of dicts were immediately turned into tables, which didn't work the same as an array of dicts, etc. But, yeah, it's not crazy implementing things in q/K, as long as they're mostly linear things. Trees are hard, iterative methods are hard, and it's really hard to skim code, other than to just rely on names and comments.
- ectoplasmaboiii 7y agoI believe they have fixed it. I just did the following: q)a: 1 2 3 0N 3 4 q)sum a 13 q)+/[a] 13