Concluding in Code
Ξ September 19th, 2009 | → 5 Comments | ∇ CCS, articles |
In their article, “The Early Deveopment of Programming Languages,” Donald E. Knuth and Luis Trabb conclude their article with computer code:
The TPK alogrithm in the “international algebraic language,” also known as ALGOL. TPK here stands for Trabb-Pardo Knuth. This was a kind of “Hello, World” program (according to the Wik), although it seems more a kin to the WRT idea of benchmarking, not so much can you do this initial act, as how does this programming language express this set of processes?
Here’s the code:
procedure TPK(a[] =: b[]);
array (a[0:10], b[0:21]);
comment Given 11 input values a[0],…,a[10], this procedure produces 22 output values b[0],…,b[21], according to the classical TPK algorithm:
begin for i = 10(-1)0;
begin y:= f(a[i]);
f(t) := sqrt(abs(t))+5 x t ^ 3 v ;
if (y > 400); y := 999;
b[20-2 x i] := i;
b[21-2 x i] := y;
end;
return;
integer (i)
end TPK.
What does it mean to end your essay in code, to let the code speak for itself?