APL programming language
From Academic Kids

APL (for A Programming Language, or sometimes Array Processing Language) is an array programming language invented in 1962 by Kenneth E. Iverson while at Harvard University. Iverson received the Turing Award in 1979 for his work. As with all programming languages that have had several decades of continual use, APL has changed significantly from the original language described by Iverson in his book A Programming Language in 1963. One thing that has remained constant is the interpretive nature of the APL programming environment, a feature much appreciated by its users. Conversely, its initial lack of support for both structured and modular programming has been solved by all the modern APL incarnations. One much criticized aspect still remains, though: the use of a special character set (see Character set below.)
Contents 
Overview
Over a very wide set of problem domains (math, science, engineering, computer design, robotics, data visualization, actuarial science, traditional DP, etc.) APL is an extremely powerful, expressive and concise programming language, typically set in an interactive environment. It was originally created as a way to describe computers, by expressing mathematical notation in a rigorous way that could be interpreted by a computer. It is easy to learn but APL programs can take some time to understand. Unlike traditional structured programming languages, code in APL is typically structured as chains of monadic or dyadic functions and operators acting on arrays. Because APL has so many nonstandard primitives (functions, operators, or features built into the language and indicated by a single symbol or a combination of a few symbols), APL does not have function or operator precedence. The original APL did not have control structures (loops, ifthenelse), but the array operations it included could simulate structured programming constructs. For example, the iota function (which yields an array from 1 to N) can simulate forloop iteration. More recent implemetations of APL generally include explicit control structures, so that data structure and controlflow structure can be more clearly separated.
The APL environment is called a workspace. In a workspace the user can define programs and data, i.e. the data values exist also outside the programs, and the user can manipulate the data without the necessity to define a program, for example:
 <math>N \leftarrow 4\ 5\ 6\ 7<math>
Assign the vector values 4 5 6 7 to N.
 <math>N+4\,\!<math>
Add 4 to all values (giving 8 9 10 11) and Print them (absence of the assignment arrow means "show")
 <math>+/N\,\!<math>
Print the sum of N, i.e. 22
The user can save the workspace with all values and programs. In any case, the programs are not compiled but interpreted.
APL is wellknown for its use of a set of nonASCII symbols that are an extension of traditional arithmetic and algebraic notation. These cryptic symbols, some have joked, make it possible to construct an entire air traffic control system in two lines of code. Indeed, in some versions of APL, it is theoretically possible to express any computable function in one expression, that is in one line of code. You can use the other line for I/O, or constructing a GUI. Because of its condensed nature and nonstandard characters, APL has sometimes been termed a "writeonly language", and reading an APL program can feel like decoding an alien tongue, except to mathematicians, who find more prolix languages much harder to understand. Because of the unusual character set, many programmers used special APL keyboards in the production of APL code. Nowadays there are various ways to write APL code using only ASCII characters. Indeed most if not all modern implementations use the standard keyboard, displaying APL symbols by use of a particular font.
Advocates of APL claim that the examples of "writeonly" code are almost invariably examples of poor programming practice or novice mistakes, which can occur in any language. APL has perhaps had an unusually high percentage of users who are subjectmatter experts who know some APL, rather than professional programmers who know something about a subject.
Iverson designed a successor to APL called J which uses ASCII "natively". So far there is only a single source of J implementations: http://www.jsoftware.com/ Other programming languages offer functionality similar to APL. A+ (http://www.aplusdev.org/) is an open source programming language with many commands identical to APL.
Examples
Here's how you would write a program that would sort a word list stored in vector X according to word length:
X[X+.¬' ';]
Here's a program that finds all prime numbers from 1 to R:
 <math>\left(\sim R \in R \circ . \times R\right)/R \leftarrow 1 \downarrow \iota R<math>
Here's how to read it, from right to left:
 <math>\iota\,\!<math> creates a vector containing integers from 1 to R (if R = 6 at the beginning of the program, <math>\iota R\,\!<math> is 1 2 3 4 5 6)
 Drop first element of this vector (<math>\downarrow<math> function), i.e. 1. So <math>1 \downarrow \iota R<math> is 2 3 4 5 6
 Set R to the vector (<math>\leftarrow<math>, assignment primitive)
 Generate outer product of R multiplied by R, i.e. a matrix which is the multiplication table of R by R (<math>\circ . \times<math>function)
 Build a vector the same length as R with 1 in each place where the corresponding number in R is in the outer product matrix (<math>\in<math>, set inclusion function), i.e. 0 0 1 0 1
 Logically negate the values in the vector (change zeros to ones and ones to zeros) (<math>\sim<math>, negation function), i.e. 1 1 0 1 0
 Select the items in R for which the corresponding element is 1 (<math>/\,\!<math> function), i.e. 2 3 5
Calculation
APL was unique in the apparent speed with which it could perform complex matrix operations. For example, a very large matrix multiplication would appear to take only a few seconds on a machine which was much less powerful than those today. The secret was the pervasive use of lazy evaluation where calculations would not actually be performed until the results were needed and then only those calculations strictly required.
Terminology
APL makes a clear distinction between functions and operators. Functions take values (variables or constants or expressions) as arguments, and return values as results. Operators take functions as arguments, and return related, derived, functions as results. For example the "sum" function is derived by applying the "reduction" operator to the "addition" function. Applying the same reduction operator to the "ceiling" function (which returns the larger of two values) creates a derived "maximum" function, which returns the largest of a group (vector) of values. In the J language, Iverson substituted the terms 'verb' and 'adverb' for 'function' and 'operator'.
APL also identifies those features built into the language, and represented by a symbol, or a fixed combination of symbols, as primitives. Most primitives are either functions or operators. Coding APL is largely a process of writing nonprimitive functions and (in some dialects of APL) operators. However a few primitives are considered to be neither functions nor operators, most noticeably assignment.
Character set
APL has always been criticized for its choice of a unique, nonstandard character set. The fact that those who learn it usually become ardent adherents shows that there is some weight behind Iverson's idea that the notation used does make a difference. In the beginning, there were few terminal devices which could reproduce the APL character set — the most popular ones employing the IBM Selectric print mechanism along with a custom type element. With the popularization of the Unicode standard, which contains an APL character set, the eternal problem of obtaining the required particular fonts seems poised to go away.
APL symbols and keyboard layout
APL_keyboard.gif
Note the mnemonics associating an APL character with a letter: question mark on Q, power on P, rho on R, base value on B, eNcode on N, modulus on M and so on. This makes it easier to type APL on a nonAPL keyboard providing you have visual feedback on your screen.
All APL symbols are present in Unicode:
It may be required to significantly reconfigure your browser in order to display Unicode fonts.
'  (  )  +  ,    .  /  :  ;  <  =  >  ?  [  ] 
\  _  ¨  ¯  ×  ÷  ←  ↑  →  ↓  ∆  ∇  ∘  ∣  ∧  ∨ 
∩  ∪  ∼  ≠  ≤  ≥  ≬  ⊂  ⊃  ⌈  ⌊  ⊤  ⊥  ⋆  ⌶  ⌷ 
⌸  ⌹  ⌺  ⌻  ⌼  ⌽  ⌾  ⌿  ⍀  ⍁  ⍂  ⍃  ⍄  ⍅  ⍆  ⍇ 
⍈  ⍉  ⍊  ⍋  ⍌  ⍍  ⍎  ⍏  ⍐  ⍑  ⍒  ⍓  ⍔  ⍕  ⍖  ⍗ 
⍘  ⍙  ⍚  ⍛  ⍜  ⍝  ⍞  ⍟  ⍠  ⍡  ⍢  ⍣  ⍤  ⍥  ⍦  ⍧ 
⍨  ⍩  ⍪  ⍫  ⍬  ⍭  ⍮  ⍯  ⍰  ⍱  ⍲  ⍳  ⍴  ⍵  ⍶  ⍷ 
⍸  ⍹  ⍺  ⎕  ○ 
Usage
APL has long had a small but fervent user base. It has been particularly popular in financial and insurance applications, in simulations, and in some mathematical applications. But APL has been used in a wide variety of contexts and for many and varied purposes.
Quotes
 "APL, in which you can write a program to simulate shuffling a deck of cards and then dealing them out to several players in four characters, none of which appear on a standard keyboard."
 "APL is a mistake, carried through to perfection. It is the language of the future for the programming techniques of the past: it creates a new generation of coding bums."
 "By the time the practical people found out what had happened; APL was so important a part of how IBM ran its business that it could not possibly be uprooted."
 Micheal S. Montalbano 1982 (see A Personal History Of Apl (http://edthelen.org/comphist/APLhist.html))
Awards
There is an annual award for contributions to APL, the Iverson Award named after the language's creator.
See also
 IBM 1130: APL \ 1130 was an early implementation (circa 1970) of APL on the IBM 1130
 J: APL's successor, by Kenneth E. Iverson and Roger Hui
 K: an alternative APL successor, by Arthur Whitney
 NGL: a descendant of APL (through J and FL), using more standard mathlike notation
 Nial
References
 A Programming Language (1962), by Kenneth E. Iverson
 A formal description of SYSTEM/360, IBM Systems Journal 3:3, New York: 1964
 History of Programming Languages, chapter 14
External links
 APL  A Programming Language (http://www.users.cloud9.net/~bradmcc/APL.html)
 Rex Swain's APL info (http://www.rexswain.com/aplinfo.html)
 SIGAPL Home Page (http://www.acm.org/sigs/sigapl/)
 APL2C Compiler (http://www.apl2c.de/home/)
 A Personal view of APL (http://elliscave.com/APL_J/IversonAPL.htm) by Kenneth E. Iverson
 Sam Sirlin's APL FAQ (http://home.earthlink.net/~swsirlin/apl.faq.html) (Frequently Asked Questions list)
 Scanned manuals for early APL implementations (http://www.classiccmp.org/bitsavers/pdf/ibm/apl/) (APL \ 360 and APL \ 1130)
 A Personal History Of Apl (http://edthelen.org/comphist/APLhist.html) by Micheal S. Montalbano
Template:Major programming languages small
Special characters
Template:SpecialCharsda:APL de:APL (Programmiersprache) es:Lenguaje de programación APL eo:APL fr:APL (langage) it:APL nl:Programmeertaal APL pl:APL (język programowania) ja:APL ru:АПЛ (язык программирования) sv:APL zh:APL