J vs. K by Example
olegykj.sourceforge.net
olegykj.sourceforge.net
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.
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.
https://en.wikipedia.org/wiki/K_(programming_language)
And I guess there's also Q.
Which one of these has some industry traction?
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.
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/ 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.
Asking because I'm thinking of adding some form of array language to the statistical/data science Racket framework.
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.
The most recent version of K is K9, aka "Shakti"
]D=.~. S=.
I thought I was looking at a sendmail config file at first!