5 ms·
Can someone who knows all those one letter languages well succinctly describe the differences between J, K, Q and APL? What I think I've got so far (this is al
by Tomte 6y ago
Can someone who knows all those one letter languages well succinctly describe the differences between J, K, Q and APL?
What I think I've got so far (this is all hearsay, and none should be taken as fact):
APL: The original. Non-ASCII. APLers hate the successors, because "notation is tool for thought" and ASCII is a poor representation. Main implementations GNU APL (slowish), Dyalog (fast and expensive, free version available, good documentation)
K: ASCII, used in finance (among other sibling languages, dependent on the concrete company and concrete group within a company), comes with kdb+ (columnar data store, integrated with K), very fast (main interpreter loop in processor cache), one real implementation (very very expensive, limited free version available), several cvariations on the language, some of them open source, none comparable
Q: syntax sugar upon K, but otherwise exactly the same
J: another evolutionary strang of APL, impeccable pedigree (Iverson), free software, experiments more with language features, is more complete when it comes to the "linguistic" style (adverbs etc.), database available (Jd, but this database is commercial), slower than K, more extensions like for GUI programming
- SifJar 6y agoOn K - there are now two "real" implementations, one by Kx Systems (i.e. the version under the hood of kdb+) and one by Shakti (new company from Arthur Whitney, original author of k). The Kx one is k4, Shakti is k9. Having said that, k9 is still quite a "work in progress", don't think it's considered production ready yet. May also be worth nothing that k4 is essentially "undocumented" and Kx encourage to use q instead of writing any code in k directly. Most functionality can be pieced together using docs from other versions of k (I think k2 manual is floating around online) & the docs from q.
- felixr 6y agoI thought Shakti started at k7, and k5 and k6 have also a Kx implementation. BTW, https://ngn.bitbucket.io/k.html https://ngn.bitbucket.io/k.html is a great overview of K implementations and which version they are implementing. edit: k5, k6, k8 were apparently never released (https://aplwiki.com/wiki/K https://aplwiki.com/wiki/K)
- SifJar 6y agoYep, for a while Shakti was k7, but then Arthur started over & it became k9. Not sure what happened with k8 k5 was also known as "kOS" and was to be a version of k as a full OS that could run directly on hardware - I believe that got abandoned due to the pain of writing drivers http://archive.vector.org.uk/art10501320 http://archive.vector.org.uk/art10501320 - article about kOS before it was abandoned
- bambataa 6y agoHow does q relate to K? I dabbled a little but the distinction was never clear to me.
- rscho 6y agoQ is K syntactic sugar to make the system easier and more "traditional".
- icen 6y agoq is k with all of the monadic verbs being replaced by English words: `+` is `flip`, `=` is `group`, `-` is `neg`, and so on. It also has q-sql, a SQL like sublanguage for conveniently working with tables. k has the verbs that implement it, but they're not really as convenient.
- snicker7 6y agoThe main difference is the introduction of qsql (SQL-ish statements can be treated as expressions) and some utility functions that are defined in K. QSQL is mostly for business analyst folks, and is just syntax sugar over the K-native `?` and `!` functions (which is more powerful than qsql).
- deleted 6y ago[deleted]
- rscho 6y agoSome additions: The major difference separating j from k is that the former is optimized for multidimensional arrays (_i.e_ math), while the latter is optimized for vector processing (_i.e_ financial data) and uses lists of vectors when working with higher dimensions. J is also fast, but not for the same things as k. It's interpreter is also designed to fit in the cache. Dyalog APL has been experimenting with bytecode compilation, although I don't know whether it's implemented in the current version. It also has a gpgpu extension with restrictions on the language (Co-dfns). Unlike j, APL does not implement operations such as matrix multiplication by calling to BLAS, so if you're doing matrices on the CPU, use J. As an aside, j also shines for graphical output with its opengl bindings and its 2d/3d Matrix viewer. BTW Jd is indeed commercial, but is free to use in non-commercial applications. Personally, I think that k is much more popular on hn because they're aggressively promoting it. J is better if you're not doing financial work.
- moonchild 6y ago> j's interpreter is also designed to fit in the cache $ du -sh /usr/lib/j9/bin/libj.so 3.2M /usr/lib/j9/bin/libj.so Might be a tight fit... Kdb k is only 771kb, and shakti k is 120kb.
- the_optimist 6y agoJ is a general-purpose language. It is oriented toward math and data handling far more than K. Speed relative to K, for example, is largely dependent upon what operators are used, with what size and shape of data. Certain operations in J are highly optimized, comparable to C (or exceeding) what you'd find in matrix math libraries.
- jodrellblank 6y agoJ came along particularly to fix the ASCII problem, but it took some design decisions for things that were bugging Ken Iverson from years of APL work, that var[4] style indexing is really a function application, that all functions should have configurable “rank”, that tacit programming with trains of functions should be a focus, among other things. Many of those choices have been added to Dyalog APL since then, SQUAD indexing function, trains, rank adjustment operator. Dyalog APL has traditional APL functions and keywords which looks a lot more procedural than the golfed symbols mostly shown - for loops, if statements, etc. which GNU APL has not, IIRC; and has an object system :Class and a bridge to the .Net framework and C# interop both ways, GUI support possible through that (Windows Forms I think).
- Rampoina 6y ago> APLers hate the successors, because "notation is tool for thought" and ASCII is a poor representation. I'm perplexed by this one. I'll concede that the APL symbols are prettier but why does it magically stop being a notation just because you use combinations of ASCII symbols. Especially when many APL symbols are composed of units themselves. ⍲ vs *: One is 'notation' because it has the two units stacked on top of each other and the other is not because they are stacked horizontally?
- Tomte 6y agoI've wondered that myself, because the zoo of symbols doesn't speak to me, like iota, but maybe the mathematical use has something to do with the APL use. So I simply assume there is something deeper going on than "it looks ugly". Maybe someone here is in that camp and can tell us. At least the argument was made on HN in some earlier APL or J thread.
- OnlyOneCannolo 6y agoAre you really saying that non-ASCII is notation and ASCII is not? When I read your first comment, I understood it to mean that better notation is better than worse notation.
- Tomte 6y agoI'm not saying that. Some APL fans say that ASCIIfication of APL is a bastardization, because notation matters. (search through earlier HN threads) Notation is obviously a shorthand for "sensible notation" or even "better notation" there, because obviously just about anything can be notation. Including laying out pebbles on a beach. But further than that, I don't know.
- rscho 6y agoThe usual argument is that "one should APL like one reads music", meaning that with experience you immediately recognize specific patterns which help you understand what is going on. As for why ASCII can't do that, only the critics know their true reason, which I suspect amounts to "it's different from what I'm used to". I've done both, and I found J notation no more obscure. Critics should also note that (Dyalog) APL departed from APL2 to copy many J patterns, so it appears difficult to argue that J was such a mistake to begin with. Some people hold prejudice against parentheses and prefix notation, for others it's ASCII...
- jxy 6y ago> J: ... slower than K This is debatable. Given the clause in Kdb+ on demand license [0], it is healthy to give all the published performance figures the benefit of doubt. [0] "1.3 Kdb+ On Demand Software Performance. End User shall not distribute or otherwise make available to any third party any report regarding the performance of the Kdb+ On Demand Software, Kdb+ On Demand Software benchmarks or any information from such a report unless End User receives the express, prior written consent of Kx to disseminate such report or information." -- https://ondemand.kx.com https://ondemand.kx.com
- ngnk 6y agohttps://i.imgur.com/sJJWBtq.png https://i.imgur.com/sJJWBtq.png