proj-plbook-plChIversonArrayLangs

Difference between revision 13 and current revision

No diff available.

Table of Contents for Programming Languages: a survey

Iverson array languages

Links:

APL

Source code is in non-ASCII symbolic notation.

Retrospectives:

Links:

A+

"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." -- [1]

Links:

J

"a synthesis of APL (also by Iverson) and the FP and FL function-level languages created by John Backus.[5]" -- https://en.wikipedia.org/wiki/J_%28programming_language%29

relies "mainly on symbols, but these are drawn from the ASCII character set" -- [2]

"after a full career of applying and refining APL in commercial applications (Ken Iverson) 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." -- [3]

"Basically, it is a dialect of APL with the same functionality, but employing the ASCII character set instead of APL's original unique character set. " -- http://cgibin.erols.com/ziring/cgi-bin/cep/cep.pl?_alpha=jk

Successor to APL.

Creators: Ken Iverson, Roger Hui

Influenced: NumPy?

J Opinions:

Retrospectives:

J Features

9 control structures [7]:

break/continue are available.

J Precedence

Note that J has a nonstandard meaning of the word 'precedence'. When J says that a word has high precedence, that means that that word 'executes first', where execution is understood to be mixed with parsing. The word that 'executes first' can then determine how to group the surrounding words together into arguments. If it chooses to group many words together, that would be equivalent to a situation that would be called "low precedence" with the standard use of the term "precedence". [8]

Verbs have no precedence (so, for example, multiplication does not take group tighter than addition, and must be explicitly grouped) [9].

J syntax

Parsing and execution of J are interleaved. Up to 4 consecutive J words are examined at once to see if their parts-of-speech match one of 9 patterns. If there is a match, a subset of the matching words are evaluated and replaced by their evaluation. If there is no match, the parser looks further left. Parsing and execution are interleaved because parsing depends on the part-of-speech of the words, but I think that in some cases this cannot be known until runtime.

Comprehensive description of J syntax and of how J is parsed: https://crypto.stanford.edu/~blynn/haskell/jfh.html

Introductory tutorial descriptons: https://www.jsoftware.com/help/jforc/preliminaries.htm#_Toc191734292 https://www.jsoftware.com/help/jforc/tacit_programs.htm https://www.jsoftware.com/help/jforc/introduction_to_forks.htm

https://www.jsoftware.com/help/learning/01.htm https://www.jsoftware.com/help/learning/02.htm https://www.jsoftware.com/help/learning/03.htm and later chapters in that one, eg: https://www.jsoftware.com/help/learning/09.htm

https://crypto.stanford.edu/~blynn/haskell/jfh.html

Parts of speech

Words (tokens) in J are classified as various parts of speech [10]:

Forks

If three verbs are juxtaposed (ie separated by spaces), that is, (V0 V1 V2), then this is interpreted as a 'fork', meaning a function such that if a noun is applied, the noun will be applied to the first and to the third verb (taken as unary operators), and then the results will be applied to the second verb (taken as a binary operator); that is to say [18],

(V0 V1 V2) Ny is the same as (V0(Ny)) V1 (V2(Ny))

For example,

avg=: +/ % #

here, '+/' is a fold of + (ie. the sum function), '%' is division, and '#' takes the length of an array.

Control structures

English ('primitives') script

https://code.jsoftware.com/wiki/Guides/Primitives

The Primitives script provides English aliases for various J primitives.

J implementations and variants

J Incunabulum

A tiny implementation of a fragment of J. https://code.jsoftware.com/wiki/Essays/Incunabulum

https://rickyhan.com/jekyll/update/2020/01/16/j-incunabulum-disected.html

It's also in Appendix A of An implementation of J by Roger K.W. Hui

Related:

J Tutorials

Comparisons with other Iverson array languages

J links

K

"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." -- [20]

however note that there is Kona, an open-source variant of K, and oK

Tutorials:

Comparisons with over Iverson array languages:

oK:

Comparisons with over Iverson array languages:

Links:

Q

"Q is a thin wrapper around K, providing a more readable, English-like interface." [22] [23]. Developed for the database kdb+.

Links:

Kerf

https://scottlocklin.wordpress.com/2015/12/15/an-introduction-to-kerf/

BQN

https://aplwiki.com/wiki/BQN