From APL Wiki
Jump to navigation Jump to search

APL\3000 was an APL implementation for the Hewlett-Packard HP 3000 Series II minicomputer. Its design and new features were published in the July 1977 issue of HP Journal.[1] Marketed as "the first time a large-machine APL has been available on a small computer" (that is, not a mainframe), APL\3000 followed the APL.SV model closely, and featured exactly the same set of primitives. However, it featured the new implementation techniques of a dynamic compiler and subscript calculus, usability features like a workspace transparently backed by disk space and improved interactive debugging, and the first commercially available APLGOL implementation. The development of APL\3000 was led by John Walters, and Rob Kelley worked on the compiler and APLGOL design. Larry Breed and Phil Abrams assisted in developing the APL compiler.


APL\3000's implementation was an early example of dynamic compilation or just-in-time compilation. Every function was compiled on its first invocation, resulting in both executable code for that invocation and "signature instructions" to test whether the same code could be used for later invocations. On later calls to the function, the signature code would be run first: if it failed, then the function would be recompiled with less strict requirements so that the compiled code would work for the new invocation as well as previous ones. Compilation and recompilation were both performed using stored abstract syntax trees for statements called "D-trees". The compiler targetted a stack-based "software/firmware" instruction set including typical low-level instructions as well as APL scalar functions.

The system implemented Phil Abrams' subscript calculus by storing the rank and shape of an array, along with delta and offset vectors, separately from its data—that is, the ravel, but not necessarily in ravel order. This system allowed Take, Drop, Reverse, Transpose, and Reshape to be implemented only by manipulating the shape and other fields, not the data itself. In combination with APL\3000's reference counting system, this allowed even arrays with different shapes to share the same data. Arrays whose data was a linear function of the index were stored as arithmetic progression vectors, omitting the data entirely.

Multiple functions could be combined into a single step using dragalong and beating, also designed by Abrams. Dragalong was implemented by walking up a syntax tree to propagate rank and shape information before compilation, while beating refers to subscript calculus optimizations performed during this process. Combined functions such as RANK, produced from two adjacent Shape functions, and POLYCAT, from multiple copies of Catenate could be generated in this step.

APL\3000's unlimited workspace size was implemented using a virtual memory system capable of paging parts of the workspace to disk. The least recently used page was always chosen to be paged out.

Four internal data types were used: 8-bit characters, packed 1-bit Booleans, 16-bit integers, and 64-bit floating-point values. APL\3000 had a maximum rank of 63 and a maximum bound of 32,767 (the maximum value of a signed 16-bit integer).


In addition to the traditional APL language, APL provided an implementation of APLGOL, which incorporated ALGOL's structured programming as advocated by Dijkstra as a replacement for Branch-based control flow. APLGOL shared its underlying implementation with APL.

The following control structures were provided in APLGOL:

  • BEGIN statement list END
  • IF test DO statement
  • IF test THEN statement ELSE statement
  • WHILE test DO statement
  • REPEAT statement list UNTIL test
  • CASE expression OF constant BEGIN ... END CASE

Functions were written with the PROCEDURE command:

PROCEDURE header: statement list END PROCEDURE

An ASSERT command was also provided to allow the programmer to check conditions during execution.

ASSERT level: boolean expression

The level parameter allowed for inline execution.



  1. Hewlett-Packard. Hewlett-Packard Journal, July 1977.

APL dialects [edit]
Maintained APL+Win (APL*PLUS) ∙ APL2APL64APL\ivAprilCo-dfnsDyalog APLdzaima/APLExtended Dyalog APLGNU APLNARS2000ngn/apl
Historical Iverson notationA Programming LanguageA+ (A) ∙ APL#APL.68000APL.SVAPLXAPL\1130APL\360NARSopenAPLRowanSAXSHARP APLVisualAPL (APLNext) ∙ VS APLYork APL
Derivatives AHPLAPL\ivELIIIvyJJellyK (Q, KDB+) ∙ LYaPASNialRAD