APL versus A versus J versus K?

馋奶兔 提交于 2019-12-02 14:06:11
kaleidic

The differences among these languages are relatively subtle. APL "proper" has the advantages, and disadvantages, of the original symbolic notation. (There are minor changes that have been made to the symbol set over the years, but they're all true enough to the original vision.)

The A+ language is available open source. It departs significantly from the "classic" APLs, but is like them in keeping most of the core character set. My sense is that it has not been kept up to date with technology changes. It was a precursor to K.

Languages in the array-language family that have departed from the distinctive APL character set include J, K, and Nial. Nial uses English words instead of symbols, and has an open source interpreter called Q'Nial. K and J rely mainly on symbols, but these are drawn from the ASCII character set. Words may be used in place of symbols in these languages, however, simply by assigning definitions.

The APL family of programming languages have been primarily proprietary since the initial appearance of APL as an IBM product in 1964. Proprietary array languages seem to have more support and faster evolution of new capabilities than open source alternatives at this time. I'm not sure how all the competitors stack up against one another, but Dyalog APL has certainly been working actively to promote their implementation of the language as current technology. APL2000 offers products for Unix, Linux, and Windows, including VisualAPL for .Net. MicroAPL Ltd offers APLX.

K is a specialized language that is no longer being marketed on its own. Kx Systems is instead marketing the Kdb+ database and its Q (query) language, both of which are written in K. It's a powerful specialized tool, designed for high-speed processing of streaming data. It departs significantly from the original APL approach. Kx Systems products are expensive and their users mostly work in finance.

APL was envisioned and mainly designed by Ken Iverson. After a full career of applying and refining APL in commercial applications he turned to the task of making a "rationalized" revision, one that corrected the aspects of the language he'd found himself dissatisfied with over the years. This fresh take on the theme is called J. The differences between J and APL are sketched in a paper on the J Software wiki. One noticeable change is the elimination of array indexing syntax. The biggest feature, though, is tacit form, in which programs are written by composing functions without reference to their arguments. Tacit J is closely related to "point-free" style found in functional programming languages, but differs in that this form is fundamental to the J language. The ASCII-based symbols used in J may be harder to read than the more distinctive APL characters.

For an individual wanting to learn an array language, my advice is to select among Dyalog APL, APLX, J, and Q'Nial. Dyalog APL (esp. for Windows) or APLX (esp. for Linux) are likely best for someone who wants to use the core symbolism that is so distinctive to APL, and who wants strong connection with the APL community as a whole. J may be best for those who want to build web applications, or focus on math (like Project Euler,) and especially those who are fascinated by the tacit style it emphasizes. Q'Nial is what I'd pick if my priority was on open source, but only if that priority did not also mean expecting the support of an active OS community.


UPDATE: J 7.01 has been released with open source code under GPL 3. In addition there is Kona, a variant on K. These increase the options for open-source array languages.

UPDATE by Tobia: GNU APL is available under the GPL. It follows closely the latest published ISO standard on the Extended APL language. It is a great open source APL implementation and is being actively developed and maintained. There are other interesting implementations too, for example ngn APL, a surprisingly well-featured and modern implementation of APL written in Coffeescript (which compiles to Javascript.) Array languages are alive and well in 2015.

Yike Lu

To add some more information...

There is an open source version of K called Kona https://github.com/kevinlawler/kona

For q/kdb+, there is a trial version. http://kx.com/download/

The main limitations are 2 hour timeout, 32 bit memory, 3 month license expiration, and the license itself. These shouldn't be too bothersome if you just want to play around and learn something.

Personally, I found q to be the most user friendly since KX translated the monadic (single argument) verbs from K into English words and there is a good amount of documentation @ http://code.kx.com. In addition, the database system is extremely well thought out and flexible.

Something to consider is the vocabulary of operators (higher-order functions).

Original APL only has last and first axis reduction (f/, f⌿), last and first axis cumulative reduction (f\, f⍀), plus inner and outer product (f.g, ∘.g).

Most extended APLs (e.g. GNU APL, APLX, APL+Win, APL2) only add the each-loop (), and axis bracket specification (f[...]).

J, added a plethora (called adverbs and conjunctions), but removed brackets (both axis and indexing), the each operator (in favor of the more general rank operator), and last-axis (cumulative) reduction.

The now defunct Sharp APL (SAX) retained both the traditional last-axis operators and bracket indexing, while adding many of J's new operators.

Dyalog APL is gradually approaching the vocabulary of Sharp APL, but has also incorporated J-exclusive operators that never made it into Sharp APL.

The below table compares J, Sharp APL, and Dyalog APL composition vocabularies. The grayed out entries are under proposal.

J is an Executable Mathematical Notation which is input and displayed using ascii characters.

It is also a fully fledged Functional, Object Oriented, Programming Language.

The JSoftware implementation of J (I do not know of any others) is not open source, but it is free to use.

Although the engine is not open source, there is an active user library of J code to which people can contribute.

J has extensive and concise documentation http://www.jsoftware.com/help.htm and forum members happily and rapidly respond to any questions or problems and are keen to help new users become oriented as well as with more advanced problems.

On the Open Source issue by the way, the documentation (specification) for J is extensive and anybody could in theory create an open source project to try to implement J if they wanted to.

ELI is a newly developed, freely available, cross-platform, array programming language. Similar to J and k it relies on the ASCII character set. It implements some of the features that (as I know) were unique to k/q/kdb+ such as temporal datatype and inbuilt SQL subset.

While A+ appears to (sadly) be a dead project, there's a new open-source APL interpreter: GNU APL.

I also remain befuddled (APL has always confounded me - fortunately it's been 20 or more years since I last attempted anything with it), but a bit of searching has found A+, an open-source version of A:

I have no idea it it will meet your (or anyone's) needs.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!