[Inquiry] Re: Theme One Program -- Commentary
Jon Awbrey
jawbrey at att.net
Tue Jan 18 13:28:56 CST 2005
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
TOP. Commentary Note 3
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
In this first pass over the code I will focus on the more generic
functionalities of the program and tread lightly by the low level
primitives that are peculiar to this particular version of Pascal.
As a general rule I will be transforming most of the basic Pascal
input-output procedures into a roughly equivalent functional form.
Video.
procedure video (what: mode);
begin
case what of
null: textcolor (0);
moot: textcolor (7);
firm: textcolor (14)
end
end;
This procedure sets the screen display to one of three colors:
null = black on black, moot = dim blue, firm = bright yellow.
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
Stop.
procedure stop;
var mark: char;
begin
write ('< press any key > '); repeat until keypressed;
mark := readkey
end;
This procedure writes a prompt and waits for a keypress.
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
Just.
function just (this: idea): idea;
begin
just := nil
end;
This is a function from ideas to ideas
that constantly outputs the 'nil' idea.
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
Clear.
function clear (this: idea): idea;
begin
clear := this; clrscr
end;
This is a function from ideas to ideas,
that acts as the identity on the input,
with a side-effect to clear the screen.
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
Clean.
function clean (this: idea): idea;
begin
clean := just (clear (this))
end;
This is a function from ideas to ideas,
that constantly outputs the 'nil' idea,
with a side-effect to clear the screen.
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
inquiry e-lab: http://stderr.org/pipermail/inquiry/
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
More information about the Inquiry
mailing list