APL
APL (A Programming Language) is a language of programming originating from mathematical notation developed by Kenneth Iverson in 1957, who implemented it in 1962 when he was hired by IBM that same year.
Features
The APL is an applicative language or a language to apply something, similar to a functional language.
It uses parameterizable operators, so it's very concise. Its syntax is based on a few "operators" and uses a special set of characters that are not present in the ASCII code. The set of operations is based on abstract linear algebra, making it an ideal language for working with vectors and matrices. It has a repertoire of operators that allows it to compose new logical or mathematical operations.
By having generalized cross products and dots, a single sentence can be translated into many lines of other languages, such as Fortran, Basic, PL1, C, etc. Since, in these, these operations and others are implemented through loops or iterative cycles (loops).
An example of this is the circuit simulation language, SIAL, which, having occupied approximately 25,000 statements in the Fortran-Assembler language, went on to be rewritten in APL to occupy two pages in its printed version. On the other hand, despite being such a high-level language, it is also capable of bit-scale manipulation and interfaces with low-level programming languages (C, assembler, etc.) through so-called processors. auxiliaries.
It has the property that from a routine it is possible, at run time, to create, compile and execute other routines, which makes it also very suitable for the automatic elaboration of compilers and interpreters.
Some practical difficulties lie in the fact that:
- You need stickers (or mark with permanent marker) on the keyboard, to be able to see the operators (APL's own symbols) that are assigned to each key (can be redefined by the user when and as you like).
- The programs written in APL are very concise and this can make them prolific to document and understand for beginners. However, for the initiates, their brevity and the order of execution (every sentence is always executed from right to left) greatly facilitates their follow-up.
- By being interpreted (in running time), its speed is typically somewhat slower than that of applications with compiled programming languages. Therefore, today, with the high speeds of processors, it does not pose a significant disadvantage in most applications. On the contrary, it facilitates its immediate interactive test and review.
- Although there is a free version available in the "Free Software Fundation" catalogue, most APL interpreters or compilers are enclosed and their users do not share their code, which prevents their use from spreading, at the level that they have other languages to make arithmetic calculations such as Matlab, Mathematica, SAGE, Maxima, Octave among others.
APL Examples
APL can solve a system of equations in a single sentence if we apply it to a concrete system of equations. For example:
7x + 4y + 2z = 4
6x + 8y + 9z = 7
4x + 2y + 1z = 2
It is enough to execute ONE SINGLE APL sentence, whose syntax is:
4 7 2 3 3 ρ 7 4 2 6 8 9 4 2 1
Where the operator ρ (rho) formats the list of numbers into a 3x3 matrix. The operator ⌹ ("dominoes") calculates the inverse of the matrix and multiplies it by the vector 4 7 2, generating the solution for each variable (x, y, z):
0 1.1 -0.2
The above program could use libraries for matrix operations, Fortran allows resizable arrays, and is suitable for parallel computation. But some declarations are needed for arrays and calling subroutines, and in other inflexible languages to create subroutines with arrays, it's even more complicated because they have to be coded by loops matrix inversion and the product, at least 20 lines.
The APL allows you to think directly about algebraic operations that can be expressed in a very concise way, therefore it allows very short development and testing times. For this reason, it is a very suitable language for very varied fields, such as Mathematics, Statistics, Business, Artificial Intelligence, Prototyping, etc.
APL in popular culture
Among its best-known applications is its use in the film Tron, by Walt Disney, for the generation of special effects,
As a curiosity, in the novel Cheap Complex Devices, by J. C. Sundman, the author states that the content of the book has been written automatically by a computer, using code generated in APL, which earned him the Douglas R. Hofstadter Prize for Computer Novel Creation in 1997. All of this, of course, is a literary artifice.
Successors to the APL
Kenneth Iverson, later, was in charge of the development of a programming language, which they presented as the successor to APL, called J. One of the particular characteristics of J is what has been called tacit functional programming, in It is considered that, to express programs, it is not necessary to name variables or function parameters (These tacit programming concepts have been incorporated into the Logo language in the LogoFE library). In J, the variety of routines (which in APL are called "operators"), is much greater.
Influence on other languages
John Backus, in his Turing Award lecture, presented FP/FFP. FP is a functional language and FFP are functional forms, which were based on the application language APL. An example of the functional forms in APL is the operation reduce op/vector
which reduces a vector by applying the operator. +/1 2 3 4
computes 1 + 2 + 3 + 4
, in some languages such as some dialects of Lisp it retained the name reduce, which was inherited from other functional languages.
Contenido relacionado
Kaprekar number
ICab
Pareto distribution