| home | alphabetical index | |||||
APL programming languageAPL (for A Programming Language, or sometimes Array Processing Language) is a programming language invented in 1962 by Kenneth E. Iverson while at Harvard University. Iverson received the Turing Award in 1979 for his work.
The APL environment is called a workspace. In a workspace the user can define programs and data, i.e. the data values exists also outside the programs, and the user can manipulate the data without the necessity to define a program, for example:
N .leftarrow 4 5 6 7Assign the vector values 4 5 6 7 to N.
N+4Print the values 8 9 10 11
+/NPrint 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 notorious 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. 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. 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. Iverson designed a successor to APL called J which uses ASCII "natively". So far there is a sole single source of J implementations: http://www.jsoftware.com/ Other programming languages offer functionality similar to APL. A+ is an open source programming language with many commands identical to APL. Here's a "Hello World" program in APL:
'Hello World'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 find all prime numbers from 1 to N:
(.tilde N .contains N .circle . .product N)/N .leftarrow 1 .downarrow .iota NHere's how to read it, from right to left:
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\\1+$/ && print while $_++' References
| |||||
| copyright © 2004 FactsAbout.com | |||||