![]() |
![]() |
|
![]() |
![]() |
Encyclopedia :
A :
AP :
APL :
APL programming language |
|
|
APL programming languageAPL (for A Programming Language, or sometimesArray 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.)
OverviewOver 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 functionss 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 structuress (loops, if-then-else), 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 for-loop iteration. 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:
APL is well-known for its use of a set of non-ASCII 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 non-standard characters, APL has sometimes been termed a "write-only 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 keyboardss 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 "write-only" 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 subject-matter experts who know some APL, rather than professional programmers who know something about a subject. Iverson designed a successor to APL called J which ExamplesHere'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:
Character setAPL has always been criticized for its choice of a unique, non-standard 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. 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. Nevertheless, some critics attack not the use of a symbolic font, but rather the specific "purely circumstantial" choices that were made during the early implementation of APL, driven by the availability of a special kind of typewriter that would never become mainstream. APL symbols and keyboard layout
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 non-APL keyboard providing you have visual feedback on your screen. All APL symbols are present in Unicode:
UsageAPL 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.":— David Given
Special characters
|
|
|
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License. |
|
| © 2008 Chamas Enterprises Inc. |