TPK algorithm: Difference between revisions

Content deleted Content added
use <code> where proper (<source> doesn't support ALGOL; coloring is wrong for Perl); rm Ruby examples as repetitive
m oops, ALGOL 60 is right link; "External links" plural per MoS
Line 1:
The '''Trabb Pardo-Knuth algorithm''' is a [[computer program|program]] introduced by [[Donald Knuth]] and [[Luis Trabb Pardo]] to illustrate the evolution of computer [[programming language]]s.
 
In their [[1980]] work "The Early Development of Programming Languages", Trabb Pardo and Knuth introduced a trivial program which involved [[array]]s, [[index (information technology)|indexing]], mathematical [[Function (mathematics)|function]]s, [[subroutine]]s, [[I/O]], [[conditional]]s and [[iteration]]. They then wrote implementations of the algorithm in several early programming languages to show how such concepts were expressed.
 
The simpler [[Hello world program]] has been used for much the same purpose.
 
==The algorithm==
In [[ALGOL 60]]:
 
<code lang="algol">
Line 33:
 
==Python version==
The following Python version of the algorithm uses the common Python idiom of using a list instead of an array, (although there is an array module available):
 
<source lang="python">
Line 51:
* "The Early Development of Programming Languages" in ''A History of Computing in the Twentieth Century'', New York, Academic Press, 1980. ISBN 0-12-491650-3 (Reprinted in Knuth, Donald E., ''et al'', ''Selected Papers on Computer Languages'', Stanford, CA, CSLI, 2003. ISBN 1-57586-382-0)
 
==External linklinks==
* [http://cs.fit.edu/~ryan/compare Implementations in several modern languages]