Question

I'm trying to understand APL, J, K, and it's slightly frustrating since:

  • Most books seen to be about APL, but few APL implementations, and I don't have weird keyboards.

  • K appears to have been replaced by Q

  • J doesn't seem to have

I almost feel like I'm staring at Common Lisp, Guile, Gambit, Chicken, SBCL -- when I really want is is to see two pages of a scheme evaluator.

Thus, my question: is there a short (say ~50 page) document that discusses the core of APL/J/K, i.e things like:

  • its evaluation model

  • its parsing model (since left/right precedence seems to be important)

  • its syntax

Thanks!

Was it helpful?

Solution

I think you trailed off on "J doesn't seem to have...", so I don't know if you've already found all of the things that I'm going to link to and were dismissing them above.

My background is as a fan of a very broad set of language paradigms, and of the APL/J/Q/K set, I've chosen to spend most of my time using J. That said, given that J was developed by the same Ken Iverson of APL fame, it turns out that much of the same thinking went in to it. I even find that old papers that were written about APL seem to apply to J after a very simple transliteration effort is applied.

Low level references

The very best low level J reference (at the level of parsing, evaluation, syntax, and even its internal data structure primitives) is a set of HTML files that come with the open source distribution of J.

You can browse it online: here.

Higher level intro stuff

This blog post is actually a really good crash course on the way J thinks about things.

In addition to that, I've found that there are 2 books in particular on jsoftware.com that provide good introductions to programming in J:

  1. Learning J (shorter)
  2. J for C Programmers (much longer)

OTHER TIPS

The "classic" statement of the core of the J programming language is the Dictionary. I think it is part of the oldest document published for the language, but the version in use today has been kept up to date.

On the web, the Dictionary can be found in the third column of the following table of contents: http://www.jsoftware.com/help/dictionary/contents.htm

The same document is installed as part of the standard software installation for the language. The help system will give you access to that local copy, or you can use the OS file system to access the document directly.

Nothing has superseded that information. It is the most definitive information on J.

An excellent document is A Dictionary of APL by Ken Iverson. Although it is very short, it is not a good tutorial for the language, but it is an excellent reference. It was written before the emergence of later dialects like J and A and K, but it discusses some of the common variations in different versions of APL2.

Due to its long history, APL has undergone several fundamental changes in styles and specificity.

  • late 1950s: It was a "blackboard" language, for describing algorithms concisely and communicating the meaning precisely among human beings.
  • early 1960s: It was an algorithm design language. Used for composing high-level algorithms which would then need to be "hand-compiled" into whatever machine language was available.
  • late 1960s: Early implementations on computers.
  • early 1970s: Redesign and reimplementation as APL2.
  • late 1970s: related languages like Nial, an increasing number of "dialects".
  • early 1980s: The aforementioned Dictionary of APL which attempted to summarize and explain the full network of concepts in APL2 and dialects.
  • 1980s: J and K, etc.

So, one shouldn't be too hard on APL for not conforming to ASCII, because it predates ascii by almost a decade. It predates the very idea of a Standard Code for Information Interchange. Different machines were different. This was the '50s.

When the '60s rolled around, Iverson and crew were employed at IBM which could devote some special hardware and fabrication for realizing the special characters needed (IBM itself was even then not an "ascii" town, but used several varieties of EBCDIC codes).

APL was originally called "Iverson notation." Ken Iverson created it as a tool for expressing algebraic statements in a form that could be executed by a computer. One of the first uses as a notation was a specification of IBM's System\360.

As to the parsing model, given the large number of primitive functions, the APL designers decided on a strict right to left precedence to avoid confusion. Other programming languages at the time APL was developed had an arithmetic hierarchy, such as multiplication happening before addition with parentheses not needed. Imposing such a hierarchy on APL would make it unusable. The right to left precedence has two exceptions: array indexing and use of parentheses.

APL's syntax is designed for consistency. User defined functions take arguments in the same way as primitives, and are evaluated with the same right to left hierarchy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top