A Programming Language: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Peter Schmitt
m (A programming language moved to A Programming Language: the title has to be uppercase)
mNo edit summary
 
Line 18: Line 18:
   primes :: [Integer]
   primes :: [Integer]
   primes = sieve [2..]
   primes = sieve [2..]
     where sieve (p:xs) = p : sieve [x | x<-xs, x `mod` p /= 0]
     where sieve (p:xs) = p : sieve [x | x<-xs, x `mod` p /= 0][[Category:Suggestion Bot Tag]]

Latest revision as of 14:53, 5 July 2024

This article is a stub and thus not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and subject to a disclaimer.

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.

History

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

(∼R∈R°.×R)/R←1↓ιR


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]