Difference between revisions of "A Programming Language"
Latest revision as of 06:06, 28 December 2009
A Programming Languge (APL), invented by Ken Iverson, is a language influenced by mathematics in general and by arrays and vector mathematics in particular and is somewhat functional. As a vector/array oriented language, it also had elements of parallel programming implicit in its syntax. APL was quite odd looking because it used many non-keyboard characters borrowed from mathematics, these characters were repurposed for programming operations. The oddity of its character set kept it from ever being very popular in practical circles. It is a very terse language and inspired its successor, the J programming language, which is type of ASCII version of APL. To this day, APL and J still code the shortest versions of many algorithms (MDL,Miniumum Description Length theory). Readability is another issue.
APL was an influential programming language used to psudo-code papers for industry and research in the 1960's and 1970's. For Iverson at Harvard, APL started out as a compact pseudocode only on paper for computer scientists to teach and communicate (1962). It was made flesh later,(1967) on an actual machine, hence its strange character set. It was commonly joked that APL looked like a language for Martians.
The following expression finds all prime numbers from 1 to R. In both time and space, the calculation is O(R²). -From Wikipedia
Which is still shorter than a Haskell program using a list comprehension, 40 years later.
primes :: [Integer] primes = sieve [2..] where sieve (p:xs) = p : sieve [x | x<-xs, x `mod` p /= 0]