4 ms·
J vs. K by Example
- melling 6y agoK is a successor to J? It came 3 years later? https://en.wikipedia.org/wiki/K_(programming_language) https://en.wikipedia.org/wiki/K_(programming_language) And I guess there's also Q. https://code.kx.com/q/ref/ https://code.kx.com/q/ref/ Which one of these has some industry traction?
- rscho 6y agoBoth APL and K enjoy substantial industry use in financial and heavy industry companies. J much less so, but it is more mathematically inclined (and is open source). APL's and J's cores are very similar apart from their character sets. J has substantially more primitives, especially pertaining to mathematics. K is architecturally distinct, in that it does not have true multidimensional arrays. It instead uses lists of vectors. This is logical given its main use case: finance, i.e. analysis of rather long series of low-dimensional data. Q is syntactic sugar on top of K.
- smabie 6y agokdb+/q has the most traction. However, it could have more traction and first derivatives has done a terrible job at promoting the language. I love k/q and see a lot of the ideas of array languages perculate into the mainstream thru numpy and Pandas. However, both are really shitty compared to a true array language. I personally love k/q, J I'm not as keen about. I've also created my own array language called xs: https://cryptm.org/xs/ https://cryptm.org/xs/ I don't really work on it anymore, but it might be interesting to some folks researching/developing new array languages. I think there's a lot further we can, and k/q definitely has a bunch of warts that hopefully shakti/k9 will solve. I really want Shakti to have lexical scoping, and I feel like too many compromises are made for performance/simplicity reasons that reduces the ergonomics of current array languages.
- rscho 6y agoI use J quite a lot. I'm interested in why you're not keen about it? Asking because I'm thinking of adding some form of array language to the statistical/data science Racket framework.
- smabie 6y agoI don't know J as well as k, but it seems to map less to trading/finance, my domain of expertise. I like that k/q is a more traditional language in a sense, you can write code (if you have to) that looks like regular functional/imperative code. J is more obtuse and takes a more mathematical approach that can be confusing. I do like forks and the point free style though.
- snicker7 6y agoQ is K3 with some utility functions. It is sold by Kx Systems as part of kdb+, which I have the pleasure of working with on occasion. The most recent version of K is K9, aka "Shakti"
- beagle3 6y agoDo note that this is K2/K3 vs. J J hasn't changed much, but K has. K9, the most recent incarnation, is much simpler and more generic than the version described here, and also significantly faster.
- tluyben2 6y agoThe latest k is also still under active development by Arthur and colleagues under Shakti. There are frequent releases to play with.
- rscho 6y agoI know a fair bit of J, but never used K. What do you mean by "more generic"? I'm interested.
- beagle3 6y agoIt has 3 data shapes: atom, list, dict. Lists of elements of the same kind are called a vector, are more efficient, and are like J/APLs one dimensional array - but semantically are the same as any other list. A matrix is represented by a list of lists. No specialization there. You work on the 2nd dimension with “each”, on the 3rd with “each each”. Integers are all 64 but, but storage expands and contracts based on actual range. There is one operator for both “where” and “replicate”, one operator used for both “or” and “max”, similarly “and” and “min”. K is less pure and prefers to reuse concepts like lists instead of having more complicated (though sometimes helpful) structures like multiple dimensions. Hope that helps.
- hg35h4 6y ago]D=.~. S=. I thought I was looking at a sendmail config file at first!
- JohnHaugeland 6y agoI want this to have APL
- rscho 6y agohttps://i.imgur.com/3QdnQcE.png https://i.imgur.com/3QdnQcE.png