the ship and mitre
A wizened old man on the far side of the room extended a claw and beckoned. I approached, and drew myself down to a level three and a half feet off the ground, where the gentleman’s head was suspended on a platter of pipe-smoke. A dull twinkle showed itself in the inkpot of his eye as he began to speak. And this is what he said:
MODULE Sum EXPORTS Main;
IMPORT Math,IO;
VAR n:=0;
sum,last_sum:=0.0;BEGIN
(* Increasing n. *)
REPEAT
last_sum:=sum;
sum:=sum+1.0/(1000.0*FLOAT(n)+Math.Pi);(*IO.PutInt(n);IO.Put(”\t”);IO.PutReal(sum);IO.Put(”\n”);*)
n:=n+1;UNTIL last_sum=sum;
IO.Put(”\nIncreasing n.\n\n”);
IO.Put(”n=”);IO.PutInt(n-1); IO.Put(”\n”);
IO.Put(”sum=”);IO.PutReal(sum); IO.Put(”\n”);(* Decreasing n. *)
sum:=0.0;
last_sum:=0.0;
WITH max_n=n
DO FOR n:=max_n TO 0 BY -1 DO
last_sum:=sum;
sum:=sum+1.0/(1000.0*FLOAT(n)+Math.Pi);
END;
IO.Put(”\nDecreasing n.\n\n”);
IO.Put(”sum=”);IO.PutReal(sum); IO.Put(”\n”);END;
END Sum.
There was no doubt that his story had a beginning, a middle and an end. As the exterior world hauled me back in to its lurching deck, like an achor from an uncharted trench, I wondered which bade me the most ill.
This entry was posted on Wednesday, March 31st, 2004 at 3:50 PM and filed under Old stuff. Trackbacks are closed.
Hey! Why do you keep asking me to post stuff for you, then coming online yourself??? I’m a busy woman, y’know!
0 Sweetie(s) given
Posted on 31-Mar-04 at 11:05 pm | Permalinkoops, sorry. deus ex machina.
0 Sweetie(s) given
Posted on 31-Mar-04 at 11:05 pm | PermalinkThat’s the most accurate pen portrait of a programmer I’ve ever read. Wow.
0 Sweetie(s) given
Posted on 01-Apr-04 at 12:03 am | Permalink