Safekipedia

APL (programming language)

Adapted from Wikipedia · Discoverer experience

An old IBM typewriter with special symbols used in a computer language called APL.

APL is a special kind of programming language that was created in the 1960s by Kenneth E. Iverson. It is different from other languages because it mainly works with something called multidimensional arrays, which are like organized tables of numbers and data.

What makes APL unique is that it uses many special graphic symbols instead of normal letters to show its functions and operations. This helps people write very short and powerful programs.

Because of its clever ways of handling data, APL has had a big impact on many areas, including spreadsheets, functional programming, and tools for doing math on computers. It has also inspired the creation of several other programming languages.

History

Mathematical notation

A way to write math for working with groups of numbers, called arrays, was created by Kenneth E. Iverson while he was at Harvard University. He kept working on it in 1960 while he was at IBM, together with Adin Falkoff. He wrote a book about it in 1962 called A Programming Language. This special way of writing math was used inside IBM for small research reports about computers.

Iverson also used his special math writing in a draft chapter for a book he was writing with Fred Brooks, called Automatic Data Processing. That book came out in 1963. In 1979, Iverson got a big award called the Turing Award for his work on this math writing system.

Development into a computer programming language

In 1962, some people tried to use this math writing to describe a whole computer system. In 1963, a person named Herbert Hellerman put part of this writing into an IBM 1620 computer. Students used it in a special class about calculating functions. This early version was called Personalized Array Translator, or PAT.

Later, Iverson and others at IBM used the writing to describe how the IBM System/360 computers worked. After that, they wanted to make it work on a real computer. A person named John Lawrence asked them to help use this writing to teach people how to use computers.

Some people joined the team and they made a version of the writing work on an IBM 7090 computer. They finished this in late 1965 and called it IVSYS. They used special English words instead of the normal symbols because the computer could not show the special symbols.

IBM typeballs and typewheel containing APL Greek characters

Hardware

Before computers had screens, a special typewriter was made that had all the special symbols needed for this writing. This helped programmers type and see the symbols correctly. Later, a screen made by Tektronix could show these symbols too.

Commercial availability

The first time someone could use this writing interactively on a computer was in 1966. IBM started sharing a free version of this writing for the IBM 1130 computer in 1968. It could run with very little memory.

This writing became popular on big computers from the late 1960s to the early 1980s because it could support many users even on simpler machines. IBM made improvements to make it run faster on some of their big computers.

In the 1970s and 1980s, this writing was used on many different kinds of computers from many companies. Companies like IP Sharp Associates and Scientific Time Sharing Corporation offered services where people could use this writing on shared computers. By the mid-1980s, as cheaper personal computers became available, most people stopped using these shared services.

Microcomputers

When small computers became popular in the mid-1970s, a language called BASIC was more common. But some small computers still used this special writing. For example, the MCM/70 from 1974 and the VideoBrain Family Computer from 1977 came with their own versions of this writing. The Commodore SuperPET from 1981 also had a version made by the University of Waterloo.

APL2

In the early 1980s, IBM made a new version of this writing called APL2. This version allowed arrays to contain other arrays, which made programming easier. APL2 became the standard for new versions of this writing on different computers. Today, many companies say they are compatible with APL2 to show their products work well.

Modern implementations

New versions of this writing made by companies like APLX and Dyalog add features like object-oriented programming and support for modern technologies. There are also free versions like GNU APL for Linux and NARS2000 for Windows.

Derivative languages

This special writing influenced many other programming languages, such as A and A+, FP, Ivy, J, K, MATLAB, Nial, S, Snap_!_, Speakeasy, and the Wolfram Language.

Language characteristics

Main articles: APL (codepage) and syntax and symbols

APL is known for its special set of characters. In the past, it was hard to show these characters on old screens or printers, but today, with better technology, this is no longer a problem. However, typing APL characters can still be tricky for new users, though it gets easier with practice.

Unlike many other programming languages, APL uses chains of functions and operators that work on arrays of data. It can perform complex tasks in just one line of code, making it very powerful for certain kinds of problems. The language has its own special symbols and ways of doing things, which can seem unusual at first but become familiar with use.

n ← 4 5 6 7
Assigns vector of values, {4 5 6 7}, to variable n, an array create operation. An equivalent yet more concise APL expression would be n ← 3 + ⍳4. Multiple values are stored in array n, the operation performed without formal loops or control flow language.
n 4 5 6 7
Display the contents of n, currently an array or vector.
n+4 8 9 10 11
4 is now added to all elements of vector n, creating a 4-element vector {8 9 10 11}.
As above, APL's interpreter displays the result because the expression's value was not assigned to a variable (with a ←).
+/n 22
APL displays the sum of components of the vector n, i.e., 22 (= 4 + 5 + 6 + 7) using a very compact notation: read +/ as "plus, over..." and a slight change would be "multiply, over..."
m ← +/3+⍳4 m 22
These operations can be combined into one statement, remembering that APL evaluates expressions right to left: first ⍳4 creates an array, [1,2,3,4], then 3 is added to each component, which are summed together and the result stored in variable m, finally displayed. In normal mathematical notation, it is equivalent to: m = ∑ i = 1 4 ( i + 3 ) {\displaystyle \displaystyle m=\sum \limits _{i=1}^{4}(i+3)} . Recall that mathematical expressions are not read or evaluated from right-to-left.
Terminology of APL operators
TermDescription
functionoperation or mapping that takes zero, one (right) or two (left & right) arguments which may be scalars, arrays, or more complicated structures, and may return a similarly complex result. A function may be:
Primitive: built-in and represented by a single glyph;
Defined: as a named and ordered collection of program statements;
Derived: as a combination of an operator with its arguments.
arraydata valued object of zero or more orthogonal dimensions in row-major order in which each item is a primitive scalar datum or another array.
niladicnot taking or requiring any arguments, nullary
monadicrequiring only one argument; on the right for a function, on the left for an operator, unary
dyadicrequiring both a left and a right argument, binary
ambivalent
or monadic
capable of use in a monadic or dyadic context, permitting its left argument to be elided
operatoroperation or mapping that takes one (left) or two (left & right) function or array valued arguments (operands) and derives a function. An operator may be:
Primitive: built-in and represented by a single glyph;
Defined: as a named and ordered collection of program statements.

Naming

APL gets its name from Iverson's book titled A Programming Language. Even though the book talks about Iverson's mathematical ideas, not the actual programming language we discuss here, the name was used for the first time when implementing APL\360.

Adin Falkoff came up with the name in 1966 while working on APL\360 at IBM. One day, he wrote "A Programming Language" on a board and wrote the acronym "APL" underneath it. That’s how APL got its name. Later, some people started calling it "Array Programming Language" or "Array Processing Language," turning APL into what’s called a backronym.

Logo

British APL Association (BAPLA) conference laptop bag

People who worked with APL often got together for conferences from 1969 to 2010. During these meetings, they sometimes gave out items like stickers or cards with APL designs or pictures of apples (since "apple" sounds like "APL"). They also used special symbols from the APL keyboard.

Because APL didn’t have one main logo that everyone used, a group called the British APL Association started a project in 2021 to create one. After many people voted and gave feedback, they finally chose a logo in May 2022.

Use

APL is used for many different jobs, like handling money and insurance, making smart machines, and controlling robots. Some people think APL is more of a tool for calculations than a regular programming language because of its special symbols and ways to work with groups of numbers. This makes it favorite for experts who study data but may not know much about regular computer programming.

APL works well for changing pictures and making animations, since it can easily handle graphic changes. A company called Digital Effects made a product called Visions using APL to help make TV ads and the 1982 movie Tron. Even today, APL is still used in many important jobs, like managing investments, taking care of health information, and studying DNA.

Notable implementations

APL\360

The first version of APL to use its special symbols was APL\360, running on the IBM System/360. It was finished in November 1966 but was only used inside IBM at first. In 1973, its creators won an award for making APL\360 simple, fast, and easy to use.

In 1975, the IBM 5100 microcomputer included APL\360 as one of its built-in languages, with a special keyboard and screen for its symbols.

APL\1130

In 1968, APL\1130 became the first APL system that anyone could use. It was made by IBM for the IBM 1130 and became very popular.

APL*Plus and Sharp APL

Main articles: I. P. Sharp Associates and Scientific Time Sharing Corporation

APL*Plus and Sharp APL are versions of APL\360 with extra features for business use. They were made by two companies using some of the original APL\360 team members.

APL2

APL2 was a new version of APL made by IBM from 1971 to 1984. It added support for more complex data arrangements.

APLGOL

In 1972, APLGOL was an experimental version of APL that added new ways to organize commands.

Dyalog APL

Dyalog APL was first released in 1983 by a British company and works on many computers today. It is based on APL2 and adds more programming styles.

NARS2000

NARS2000 is a free APL version made by Bob Smith. It runs on Microsoft Windows and other systems.

APLX

APLX is a version of APL that works on many platforms. It was made by a British company in 2002 but is now free.

York APL

York APL was made at York University around 1968. It worked on IBM 360 computers and had a small difference in how it handled single values.

GNU APL

GNU APL is a free version of APL that works on many operating systems. It was written by Jürgen Sauermann.

Interpretation and compilation of APL

APL is usually an interpreted language, meaning it runs directly without being turned into machine code first. It has some features, like weak variable typing, that make it tricky to turn into fast-running code through compilation. But because APL works mainly with arrays, it can do some tasks very quickly by using parallelism, parallel computing, massively parallel methods, and very-large-scale integration (VLSI). People have always seen APL as a fast language, especially for complex tasks with arrays.

Even so, APL is not always just interpreted. There are ways to make it faster, like idiom recognition, where common patterns are treated as single steps. Another method is creating optimised bytecode, which simplifies some steps the computer needs to do. Some versions of APL, like Dyalog APL, use this method. Researchers have also tried to compile APL into machine code since the 1970s. Tools like the STSC APL Compiler mix bytecode optimization with compilation, turning some parts of APL into fast machine code when possible.

Standards

APL was made into an official standard by groups like the American National Standards Institute (ANSI), the International Organization for Standardization (ISO), and the International Electrotechnical Commission (IEC). There are two main standards: one for the basic APL language from 1989, and another for an expanded version from 2001.

Related articles

This article is a child-friendly adaptation of the Wikipedia article on APL (programming language), available under CC BY-SA 4.0.

Images from Wikimedia Commons. Tap any image to view credits and license.