# Talk:APL

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

# Array Languages

Array languages, such as APL, J and K, seem to be characterised by:

• Having a very simple and uniform syntax.
• Employing a terse lexical style.
• Making all primitive functions take and return whole arrays.
• Hiding from the programmer implementation details such as internal numeric types.

Array language proponents claim that these properties have a profound effect on productivity, freeing up the programmer to think at a higher level by avoiding the distractions of several levels of programming minutiae.

Arrays: rectanglar collection of items arranged along 0 or more axes, where an item is a number, a character or an array. The rank of an array is its number of axes (dimensions); the shape of an array is a vector of its axis lengths.

Arrays of non-uniform type are used to model tuples.

• APL recycles the word scalar to mean rank-0 array; vector and matrix are used for arrays of rank 1 and 2 respectively.
• A matrix with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.
• A length-0 character vector is distinct from a length-0 numeric vector.

Functions: infix, associate right with equal precedence.
Functions consume array "arguments" and return array results.
A "monadic" function is one that takes only a right argument.

Operators: infix, associate left with equal precedence.
Operators bind with array or function "operands" to form functions.
A monadic operator takes only a left operand.
Operator-operand binding is stronger than function-argument binding.
APL has only a single level of high-order function.

There is a rich set of primitive functions and operators.
Defined functions and operators enjoy the same calling syntax as their primitive counterparts.
See YouTube: Conway's Game of Life in APL and A Sudoku Solver in APL for a flavour of APL