Theme One Program • Commentary 2005

From InterSciWiki
Jump to: navigation, search

Author: Jon Awbrey

Contents

Commentary Note 1

These notes continue the first layer of comments on the Theme One Program.

Commentary Note 2


The main things to get out of the declaration section
are the definitions of the 'idea' and 'form' data types.

{ compiler: turbo pascal, version 5.0, }
{ (c) 1987, 1988 borland international }
{$M 53248,0,655360} { stack and heap   }
{$B+} { boolean complete evaluation on }

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

{ project: theme
  segment: learner + modeler                         copyright: 1984 - 2005
  version: 1                                                by: jon awbrey }

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Theme.

program theme;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

uses    crt;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

const   links = '(' ;  right = ')' ;  enter = ^m ;  ender = ^z ;
        comma = ',' ;  point = '.' ;  estab = ^i ;  escap = ^[ ;
        blank = ' ' ;  quote = '`' ;  elide = ^h ;  erase = ^x ;
        aster = '*' ;  minus = '-' ;  empty = '' ;    nul = #0 ;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

type    mode = (null, moot, firm);
        cast = set of char;
        numb = 0..maxint;
        info = string;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

        idea = ^form;
        form = record
                sign: char;
                as, up, on, by: idea;
                code: numb
               end;

These are the principal data types of the Theme program.

An 'idea' is a pointer to a 'form'.

A 'form' is a record consisting of:

1.  A 'sign' of type char;

2.  Four pointers, 'as', 'up', 'on', 'by', of type idea;

3.  A 'code' of type numb, that is, an integer in [0, max integer].

Represented in terms of 'digraphs', or directed graphs,
the combination of an 'idea' pointer and a 'form' record
is most easily pictured as an 'arc', or a directed edge,
leading to a 'node' that is labeled with the other data,
in this case, a letter and a number, the other arcs out
of the node in question being kept in mind implicitly.

At the roughest but quickest level of detail,
an 'idea' of a 'form' can be drawn like this:

   o a 1
   ^
   |
   @

When it is necessary to fill in more detail,
the following schematic pattern can be used:

 ^ ^     ^
as\|up on|
   o-----o by
   | a 1 |--->
   o-----o
   ^
   |
   @

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

var     here: idea;
        size,
        trim: numb;
         con: text;

Commentary Note • Video, Stop, Just, Clear, Clean


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~~~~~~~~~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~~~~~~~~~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~~~~~~~~~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~~~~~~~~~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.

Commentary Note • Flint, Hold, Wait, Dim, Vid, Dash, Lash, Quash


Flint.

function flint (this: idea): idea;
var here: idea;

This is the declaration head of the function Flint,
declaring it as a function from ideas to ideas and
declaring a local variable "here" of the type idea.

Flint is the main repeating block of the program.
What it does will be described much further below,
when we come to the corresponding definition body.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Next comes a rather large number of low level input-output functions.
These have the form of "transformations of ideas with side-effects".
In other words, they are defined to have the type of functions from
ideas to ideas, but the main purpose of calling them is to perform
some other useful action in passing.

Hold.

function hold (this: idea): idea;
begin
 hold := this;  stop
end;

This is a function from ideas to ideas,
that acts as the identity on the input,
with a side-effect of calling the Stop
procedure, defined above, that prompts
the user for some keypress to continue.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Wait.

function wait (this: idea): idea;
begin
 wait := this;  delay (256)
end;

This is a function from ideas to ideas,
that acts as the identity on the input,
with a side-effect to delay the action
for about a quarter of a second.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Dim.

function dim (this: idea): idea;
begin
 dim := this;  video (moot)
end;

This is a function from ideas to ideas,
that acts as the identity on the input,
with a side-effect to "moot" the video
color of the characters that will next
be displayed on the screen.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Vid.

function vid (this: idea): idea;
begin
 vid := this;  video (firm)
end;

This is a function from ideas to ideas,
that acts as the identity on the input,
with a side-effect to "firm" the video
color of the characters that will next
be displayed on the screen.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Dash.

function dash (this: idea): idea;
begin
 dash := this;  clreol
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
from the cursor to the end of the line.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Lash.

function lash (this: idea): idea;
begin
 lash := this;  write (enter)
end;

This is a function from ideas to ideas,
that acts as the identity on the input,
with a side-effect to write a carriage
return character.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Quash.

function quash (this: idea): idea;
begin
 quash := dash (lash (this))
end;

This is a function from ideas to ideas,
that acts as the identity on the input,
with a side-effect to write a carriage
return character and then to clear the
screen to the end of the line of text.

Commentary Note • Space, Skip, Pass, Turn, Verse, Return, Tort, Till


Here is another batch of low level input-output functions.
Once again observe how I am wrapping all of the primitive
Pascal procedures for doing "read" and "write" operations
inside functional envelopes.  Once this is done, it will
allow us to construct the great majority of more complex
operations by means of functional composition alone.

There is one other thing to note about the Pascal syntax.
Many of the functions below will be declared as follows:

function f (var thou: text;
                this: idea): idea;

This is a function that ostensibly takes text files and ideas over to ideas,
but because the text file is declared as a "var" parameter, it is actually
tantamount to a function from texts and ideas to texts and ideas, in the
sense that calling the function may change the text file in the process.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Space.

function space (var thou: text;
                    this: idea): idea;
begin
 space := this;  write (thou, blank)
end;

This is a function from texts and ideas to (texts and) ideas.
It acts as the identity on the input idea, with a side-effect
to write a "blank" (space character) to the output text file.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Skip.

function skip (var thou: text;
                    tab: numb;
                   this: idea): idea;
var col: numb;
begin
 skip := this;  for col := 1 to tab do write (thou, blank)
end;

This is a function from texts, integers, and ideas to (texts and) ideas.
It acts as the identity on the input idea, with a side-effect of writing
the given number of "blanks" (space characters) to the output text file.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pass.

function pass (var thou: text;
                   line: info;
                   this: idea): idea;
begin
 pass := this;  write (thou, line)
end;

This is a function from texts, strings, and ideas to (texts and) ideas.
It acts as the identity on the input idea, with a side-effect to write
the given character string to the output text file.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Turn.

function turn (this: idea): idea;
begin
 turn := this;  writeln
end;

This is a function from ideas to ideas
that acts as the identity on the input,
with a side-effect to write a carriage
return to the console device, thereby
scrolling the screen (or the printer).

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Verse.

function verse (var thou: text;
                    line: info;
                    this: idea): idea;
begin
 verse := this;  writeln (thou, line)
end;

This is a function from texts, strings, and ideas to (texts and) ideas.
It acts as the identity on the input idea, with a side-effect of writing
the given character string and a carriage return to the output text file.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Return.

function return (var thou: text;
                     this: idea): idea;
begin
 return := this;  writeln (thou)
end;

This is a function from texts and ideas to (texts and) ideas.
It acts as the identity on the input idea, with a side-effect
of writing a carriage return to the output text file.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Tort.

function tort (this: idea): idea;
begin
 tort := this;  write ('))')
end;

This is a function from ideas to ideas
that acts as the identity on the input,
with a side-effect of writing a pair of
right parentheses to the console device.

This function is left-over from a developmental
stage of the program when it used to write out
its own execution trace, to use in debugging.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Till.

function till (this: idea): idea;
begin
 till := this;  write (' ... ')
end;

This is a function from ideas to ideas that
acts as the identity on the input idea, and
has the side-effect of writing an "ellipsis"
to the console device (screen or printer).

Commentary Note • At, Check, Memcheck


Just a few more perfunctory functions to dispense with
before we get down to something a bit more interesting.

At.

function at (row, col: numb;
                 this: idea): idea;
begin
 at := this;  gotoxy (col, row)
end;

This is a function from pairs of integers and ideas to ideas that
acts as the identity on the input idea and has a side-effect of
placing the cursor at the row and column of the screen display
that is specified by the given pair of integers.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Check.

function check (this: idea): idea;
begin
 check := this;  write (memavail, ' bytes')
end;

This is a function from ideas to ideas
that acts as the identity on the input,
with the side-effect of writing out to
the screen display the number bytes of
memory that are available in the heap.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Memcheck.

function memcheck (this: idea): idea;
begin
 memcheck := at (1, 48, this);
 write ('< free memory : ', memavail : 8, ' bytes >')
end;

This is a function from ideas to ideas
that acts as the identity on the input,
with the side-effect of writing out to
the screen display the number bytes of
memory that are available in the heap.

This performs the same function as Check,
but formats the output value and displays
it at a particular location on the screen.

Commentary Note • Upon, Obvert, Revert, Covert, Divert, Equity


Upon.

Upon is a function from 3-tuples of ideas to ideas.
If the first argument idea is significant, that is,
non-nil, then the functional value is equal to the
second argument idea, otherwise it is equal to the
third argument idea.  Consequently, Upon functions
in the role of a conditional test and assignment.

function upon (thus, that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if thus <> nil then here := that else here := this;
 upon := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Obvert.

Obvert is a function from pairs of ideas to ideas.
Its functional value is identical to that of the
first argument idea.  Thus, Obvert functions in
the role of the first-coordinate projection of
its argument pair.

function obvert (that, this: idea): idea;
begin
 obvert := that
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Revert.

Revert is a function from pairs of ideas to ideas.
Its functional value is identical to that of the
second argument idea.  Thus, Revert functions in
the role of the second-coordinate projection of
its argument pair.

function revert (that, this: idea): idea;
begin
 revert := this
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Covert.

Covert is a function from pairs of ideas to ideas.
Its functional value is Upon the significance of
the first argument idea set equal to a nil idea,
otherwise set equal to the second argument idea.

function covert (that, this: idea): idea;
begin
 covert := upon (that, nil, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Divert.

Divert is a function from pairs of ideas to ideas.
Its functional value is Upon the significance of
the first argument idea set equal to the second
argument idea, otherwise set equal to nil.

function divert (that, this: idea): idea;
begin
 divert := upon (that, this, nil)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Equity.

Equity is a function from pairs of ideas to ideas.
Its functional value is a nil idea unless both of
its argument ideas are significant and identical
to each other, in which case its value is equal
to their common idea.

function equity (that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then if that <> nil then
  if that = this then here := this;
 equity := here
end;

Commentary Note • Tap, Pat, Apt


Tap.

Tap is a function from text files to characters.
It takes a character off the input stream and
reports it as its current functional value,
thereby serving as a read operation.

Nota Bene.  In this version of Pascal, variables with file types,
for example, text files, must be declared as variable parameters.
One way to think of variable parameters in functional terms is to
regard them as being listed on both sides of the functional arrow.

In this way of seeing things, Tap would be a function from texts
to a product of texts with characters, Tap : Text -> Text x Char.

function tap (var thou: text): char;
var mark: char;
begin
 read (thou, mark);
 tap := mark
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pat.

Pat is a function from text files and characters to characters.
It puts a character on the output stream and reports it as its
current functional value, thereby serving as a write operation,
plus an echo of the written character in the functional result.

Nota Bene.  In this version of Pascal, variables with file types,
for example, text files, must be declared as variable parameters.
One way to think of variable parameters in functional terms is to
regard them as being listed on both sides of the functional arrow.

In this view, Pat is a function from a product of texts and characters
to a product of texts and characters, Pat : Text x Char -> Text x Char.

function pat (var thou: text;
                  mark: char): char;
begin
 write (thou, mark);
 pat := mark
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Apt.

Apt is a function from characters and ideas to ideas.
Its functional value is a nil idea unless its argument
character matches the character in the 'sign' field of
an existing form that is addressed by its argument idea,
in which case its functional value is that same address.
In this fashion, reporting a nil idea for "false" and a
non-nil idea for "true", it serves as a primitive test
function that will be called as a basic part of many
other equality, look-up, match, or test functions.

function apt (mark: char;
              this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if mark = this^.sign then here := this;
 apt := here
end;

Commentary Note • Trap, Part, Rapt


Trap.

Trap is a function from text files and ideas to ideas.
It takes a character off the input stream and assigns
it to the 'sign' field of a significant argument idea,
or reports out a nil idea if its argument idea is nil.

Nota Bene.  In this version of Pascal, variables with file types,
for example, text files, must be declared as variable parameters.
One way to think of variable parameters in functional terms is to
regard them as being listed on both sides of the functional arrow.

In this view, Trap is a function from texts and ideas
to texts and ideas, Trap : Text x Idea -> Text x Idea.

For example, if 'thou' has a legitimate character next in line, say "a",
and if 'this' is a non-nil idea, then Trap yields an idea of this shape:

     o-----o
     | a   |
     o-----o
     ^
trap |
     @

function trap (var thou: text;
                   this: idea): idea;
begin
 trap := this;
 if this <> nil then read (thou, this^.sign)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Part.

Part is a function from text files and ideas to ideas.
It puts a character from the 'sign' field of a non-nil
argument idea on the output stream and reiterates this
idea as its current functional value, thereby serving
as a write operation that copies the authorizing idea
to the functional result.  If the argument idea is nil,
then the write operation is skipped and the functional
value is likewise a nil idea.

Nota Bene.  In this version of Pascal, variables with file types,
for example, text files, must be declared as variable parameters.
One way to think of variable parameters in functional terms is to
regard them as being listed on both sides of the functional arrow.

In this view, Part is a function from texts and ideas
to texts and ideas, Part : Text x Idea -> Text x Idea.

For example, if 'this' is a non-nil idea of the following shape,
then the functional value of part (this) is the very same idea,
with the side-effect of writing "a" to the argument text file.

     o-----o
     | a   |
     o-----o
     ^
part |
     @

function part (var thou: text;
                   this: idea): idea;
begin
 part := this;
 if this <> nil then write (thou, this^.sign)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Rapt.

Rapt is a function from pairs of ideas to ideas.
Its functional value is a nil idea unless both of
its argument ideas are non-nil and have identical
characters in their 'sign' fields, in which case
its functional value is equal to the second idea.
In this fashion, reporting a nil idea for "false"
and a non-nil idea for "true", it operates as a
primitive test function that will be called as
a basic part of many other equality, look-up,
match, or test functions.

function rapt (that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then if that <> nil then
  if that^.sign = this^.sign then here := this;
 rapt := here
end;

Commentary Note • Nip, Pin


Nip.

Nip is a function from text files to integers.
It reads an integer code from the input stream
and reports it as its current functional value,
thereby serving as a numerical input operation.
Because it assumes a text file format in which
an integer code is followed by an end-of-line
marker or a blank character, a Tap operation
is used to handle the terminal space, if any.

Nota Bene.  In this version of Pascal, variables with file types,
for example, text files, must be declared as variable parameters.
One way to think of variable parameters in functional terms is to
regard them as being listed on both sides of the functional arrow.

In this view, Nip is a function from texts to
texts and integers, Nip : Text -> Text x Numb.

function nip (var thou: text): numb;
var what: numb;
    mark: char;
begin
 read (thou, what);
 if not eoln (thou) then mark := tap (thou);
 nip := what
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pin.

Pin is a function from text files and integers to integers.
It puts an integer code on the output stream and copies it
to its current functional value, in this way functioning
as a numerical write operation, accompanied by an echo
of the output integer value in the functional result.

Nota Bene.  In this version of Pascal, variables with file types,
for example, text files, must be declared as variable parameters.
One way to think of variable parameters in functional terms is to
regard them as being listed on both sides of the functional arrow.

In this view, Pin is a function from a product of texts and integers
to a product of texts and integers, Pin : Text x Numb -> Text x Numb.

function pin (var thou: text;
                  what: numb): numb;
begin
 write (thou, what, blank);
 pin := what
end;

Commentary Note • Knab, Spin, Score, Pose


Knab.

Knab is a function from texts and modes to (texts and) integers.
Mode is a data type with three possible values:  null, moot, firm.
If the argument mode is null, then the functional value of Knab is 0,
otherwise Knab gets its functional value by reading a numerical input
from the argument text file.

function knab (var thou: text;
                   what: mode): numb;
begin
 if what = null then knab := 0 else knab := nip (thou)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Spin.

Spin is a function from texts and ideas to (texts and) ideas.
Whatever the case, whether the argument idea is nil or non-nil,
the functional value of Spin is set equal to the argument idea.
However, if the argument idea is non-nil and therefore points to
existing form, Spin causes the integer value in the 'code' field
of this form to be written out to the argument text file.

function spin (var thou: text;
                   this: idea): idea;
begin
 spin := this;
 if this <> nil then write (thou, this^.code)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Score.

Score is a function from texts, integers, and ideas
to (texts and) ideas.  It gives a "formatted output"
version of Spin that is convenient for column output.
The functional value of Score is always set equal to
the argument idea, whether this is a nil idea or not.
If the argument idea is non-nil, and thus refers to
an existing form, Score causes the integer value in
the 'code' field of this form to be written out to
the argument text file, right justified in a text
field of width equal to the integer argument.

function score (var thou: text;
                    span: numb;
                    this: idea): idea;
begin
 score := this;
 if this <> nil then write (thou, this^.code : span)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pose.

Pose is a function from texts and ideas to (texts and) ideas.
In every case its functional value is equal to the argument idea,
nil or non-nil, but if the argument idea indexes an existing form,
then Pose causes the contents of the 'sign' and the 'code' fields
of the indicated form to be written out to the argument text file.

function pose (var thou: text;
                   this: idea): idea;
begin
 pose := this;
 if this <> nil then write (thou, this^.sign, this^.code, blank)
end;

Commentary Note • Anon, Anew, Alow, Abye


Anon.

Anon is a function from integers to integers
that outputs its argument incremented by one.
The argument is treated as a value parameter,
so only the functional value is upped by one.

function anon (what: numb): numb;
begin
 inc (what);  anon := what
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Anew.

Anew is a function from integers to integers
that outputs its argument incremented by one.
The argument is cast as a variable parameter,
so its value is incremented as a side-effect.

function anew (var what: numb): numb;
begin
 inc (what);  anew := what
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Alow.

Alow is a function from integers to integers
that outputs its argument decremented by one.
The argument is treated as a value parameter,
so only the functional value is decremented.

function alow (what: numb): numb;
begin
 alow := what - 1
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Abye.

Abye is a function from integers to integers
that outputs its argument decremented by one.
The argument is cast as a variable parameter,
so its value is decremented as a side-effect.

function abye (var what: numb): numb;
begin
 what := what - 1;  abye := what
end;

Commentary Note • Arch, Ante, Nigh, Trip, Next, Reck


Arch.

Arch is the 'sign' selector with respect
to the idea-form construct, and as such
a function from ideas to characters.

If 'this' is a nil idea, then arch (this) is the blank character (" ").
If 'this' is a non-nil idea, and therefore points to an existing form,
then arch (this) = this^.sign.

For example, if this = peg ("a", p, q, r, s, 1),
as shown in the picture, then arch (this) = "a".

   ^ ^     ^
   p\|q   r|
     o-----o s 
     | a 1 |--->
     o-----o
     ^
this |
     @

function arch (this: idea): char;
var mark: char;
begin
 mark := blank;
 if this <> nil then mark := this^.sign;
 arch := mark
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Ante.

Ante is the 'as'-field selector with respect to
the idea-form construct, and as such a function
from ideas to ideas.

If 'this' is a nil idea, then ante (this) is also nil.
If 'this' is a non-nil idea, and therefore points to
an existing form, then ante (this) = this^.as.

For example, if this = peg ("a", p, q, r, s, 1),
as depicted in the figure, then ante (this) = p.

   ^ ^     ^
   p\|q   r|
     o-----o s 
     | a 1 |--->
     o-----o
     ^
this |
     @

function ante (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then here := this^.as;
 ante := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Nigh.

Nigh is the 'up'-field selector with respect to
the idea-form construct, and as such a function
from ideas to ideas.

If 'this' is a nil idea, then nigh (this) is also nil.
If 'this' is a non-nil idea, and therefore points to
an existing form, then nigh (this) = this^.up.

For example, if this = peg ("a", p, q, r, s, 1),
as depicted in the figure, then nigh (this) = q.

   ^ ^     ^
   p\|q   r|
     o-----o s 
     | a 1 |--->
     o-----o
     ^
this |
     @

function nigh (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then here := this^.up;
 nigh := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Trip.

Trip is the 'on'-field selector with respect to
the idea-form construct, and as such a function
from ideas to ideas.

If 'this' is a nil idea, then trip (this) is also nil.
If 'this' is a non-nil idea, and therefore points to
an existing form, then trip (this) = this^.on.

For example, if this = peg ("a", p, q, r, s, 1),
as depicted in the figure, then trip (this) = r.

   ^ ^     ^
   p\|q   r|
     o-----o s 
     | a 1 |--->
     o-----o
     ^
this |
     @

function trip (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then here := this^.on;
 trip := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Next.

Next is the 'by'-field selector with respect to
the idea-form construct, and as such a function
from ideas to ideas.

If 'this' is a nil idea, then next (this) is also nil.
If 'this' is a non-nil idea, and therefore points to
an existing form, then next (this) = this^.by.

For example, if this = peg ("a", p, q, r, s, 1),
as depicted in the figure, then next (this) = s.

   ^ ^     ^
   p\|q   r|
     o-----o s 
     | a 1 |--->
     o-----o
     ^
this |
     @

function next (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then here := this^.by;
 next := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Reck.

Reck is the 'code' selector with respect
to the idea-form construct, and as such
is a function from ideas to integers.

If 'this' is a nil idea, then reck (this) is assigned a value of zero.
If 'this' is a non-nil idea, and therefore points to an existing form,
then reck (this) = this^.code.

For example, if this = peg ("a", p, q, r, s, 1),
as depicted in the figure, then reck (this) = 1.

   ^ ^     ^
   p\|q   r|
     o-----o s 
     | a 1 |--->
     o-----o
     ^
this |
     @

function reck (this: idea): numb;
var what: numb;
begin
 what := 0;
 if this <> nil then what := this^.code;
 reck := what
end;

Commentary Note • Scrip, Asset, Upset, Onset, Beset, Inset


Scrip.

Scrip is a special modifier that
sets the 'sign' field of a form
to a given character.

More precisely:

Scrip is a "character-controlled transformation of ideas" that takes
an idea and a character as inputs, acts as the identity mapping on
the input idea, and if this idea is non-nil and therefore points
to an existing form, it sets the 'sign' field of this form to
the input character.

For example, if 'this' is a non-nil idea, then the effect of
calling scrip (this, "a") is given by the following picture:

     o-----o
     | a   |
     o-----o
     ^
this |
     @

function scrip (this: idea;
                mark: char): idea;
begin
 scrip := this;
 if this <> nil then this^.sign := mark
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Asset.

Asset is a special modifier that
sets the 'as' field of a form
to a given idea.

More precisely:

Asset is an "idea-controlled transformation of ideas" that takes
two ideas as inputs, acts as the identity on the first, and if
the first is non-nil and therefore points to an existing form,
it sets the 'as' field of this form to the second idea.

For example, if 'this' is a non-nil idea, then the effect of
calling asset (this, that) is given by the following picture:

   ^
that\
     o-----o
     |     |
     o-----o
     ^
this |
     @

function asset (this, that: idea): idea;
begin
 asset := this;
 if this <> nil then this^.as := that
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Upset.

Upset is a special modifier that
sets the 'up' field of a form
to a given idea.

More precisely:

Upset is an "idea-controlled transformation of ideas" that takes
two ideas as inputs, acts as the identity on the first, and if
the first is non-nil and therefore points to an existing form,
it sets the 'up' field of this form to the second idea.

For example, if 'this' is a non-nil idea, then the effect of
calling upset (this, that) is given by the following picture:

     ^
that |
     o-----o
     |     |
     o-----o
     ^
this |
     @

function upset (this, that: idea): idea;
begin
 upset := this;
 if this <> nil then this^.up := that
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Onset.

Onset is a special modifier that
sets the 'on' field of a form
to a given idea.

More precisely:

Onset is an "idea-controlled transformation of ideas" that takes
two ideas as inputs, acts as the identity on the first, and if
the first is non-nil and therefore points to an existing form,
it sets the 'on' field of this form to the second idea.

For example, if 'this' is a non-nil idea, then the effect of
calling onset (this, that) is given by the following picture:

           ^
           | that
     o-----o
     |     |
     o-----o
     ^
this |
     @

function onset (this, that: idea): idea;
begin
 onset := this;
 if this <> nil then this^.on := that
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Beset.

Beset is a special modifier that
sets the 'by' field of a form to
a given idea.

More precisely:

Beset is an "idea-controlled transformation of ideas" that takes
two ideas as inputs, acts as the identity on the first, and if
the first is non-nil and therefore points to an existing form,
it sets the 'by' field of this form to the second idea.

For example, if 'this' is a non-nil idea, then the effect of
calling beset (this, that) is given by the following picture:

     o-----o that  
     |     |----->
     o-----o
     ^
this |
     @

function beset (this, that: idea): idea;
begin
 beset := this;
 if this <> nil then this^.by := that
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Inset.

Inset is a special modifier that
sets the 'code' field of a form
to a given integer.

More precisely:

Inset is an "integer-controlled transformation of ideas" that takes
an idea and an integer as inputs, acts as the identity mapping on
the input idea, and if this idea is non-nil and therefore points
to an existing form, it sets the 'code' field of this form to
the input integer.

For example, if 'this' is a non-nil idea, then the effect of
calling inset (this, 1) is suggested by the following figure:

     o-----o
     |   1 |
     o-----o
     ^
this |
     @

function inset (this: idea;
                what: numb): idea;
begin
 inset := this;
 if this <> nil then this^.code := what
end;

Commentary Note • Peg, Dot, Eye, Tag, Tog, Tip


Peg.

Peg is a generic constructor of idea-to-form flags.
In some areas of math, an edge incident to a node,
or a line incident to a point, is called a "flag".

The function call, here := peg (mark, when, thus, that, this, what),
leaves the idea 'here' pointing to a newly generated form that has
its fields set in turn as follows:

here^.sign := mark
here^.as   := when
here^.up   := thus
here^.on   := that
here^.by   := this
here^.code := what

For example, the effect of here := peg ("a", p, q, r, s, 1),
assuming the proper data types, can be indicated as follows:

   ^ ^     ^
   p\|q   r|
     o-----o s
     | a 1 |--->
     o-----o
     ^
here |
     @

function peg (     mark: char;
 when, thus, that, this: idea;
                   what: numb): idea;
var here: idea;
begin
 new (here);  with here^ do
  begin
   sign := mark;
     as := when;  up := thus;  on := that;  by := this;
   code := what
  end;
 peg := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Dot.

Dot is a special constructor that
uses the generic constructor Peg
to create an idea-form structure
of the following shape:

    o-----o
    | ø 0 |
    o-----o
    ^
dot |
    @

Notice that Dot generates a form
whose 'sign' field is initialized
as the 'nul' character (#0), here
written "ø".

function dot: idea;
begin
 dot := peg (nul, nil, nil, nil, nil, 0)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Eye.

Eye is a special constructor that
uses the generic constructor Peg
to create an idea-form structure
of the following shape:

    o-----o
    |   0 |
    o-----o
    ^
eye |
    @

Notice that Eye generates a form
whose 'sign' field is initialized
as the blank character (" "), here
left blank.

function eye: idea;
begin
 eye := peg (blank, nil, nil, nil, nil, 0)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Tag.

Tag is a special constructor that
initiates an idea of a form with
a specific character as its sign.

For example, if mark = "a", then tag (mark)
is an initialized idea-form structure with
the letter "a" in the sign field, like so:

    o-----o
    | a 0 |
    o-----o
    ^
tag |
    @

function tag (mark: char): idea;
begin
 tag := peg (mark, nil, nil, nil, nil, 0)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Tog.

Tog is a special constructor that
initiates an idea of a form whose
'as' value is set to a given idea.

For example, if 'this' is given as the argument idea, whether
nil or otherwise, then tog (this) is an initialized idea-form
structure with the 'as' field of the form set equal to 'this',
as shown in the following picture:

    ^
this \
      o-----o
      |   0 |
      o-----o
      ^
  tog |
      @

function tog (this: idea): idea;
begin
 tog := peg (blank, this, nil, nil, nil, 0)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Tip.

Tip is function from keyboard inputs to ideas.
It waits on the user to press a key, normally
in response to a previous prompt, and creates
an idea-form structure that records the event.

The additional degree of complication in the function is
necessary to deal with the way that the readkey function
handles escape sequences in this version of Turbo Pascal.

Case 1.  Readkey gets ordinary character.

    o-----o
    | a 0 |
    o-----o
    ^
tip |
    @

Case 2.  Readkey gets escape sequence.

          o-----o
          | a 0 |
          o-----o
          ^
          | on
    o-----o
    | ø 0 |
    o-----o
    ^
tip |
    @

function tip: idea;
var here: idea;
begin
 here := tag (readkey);
 with here^ do if sign = nul then on := tip;
 tip := here
end;

Commentary Note • Cog, Nib, Nob


Cog.

Cog is a transformation of ideas that is
performed for the sake of its side-effect
on the form addressed by the argument idea.
 
Cog acts as the identity transformation on the argument idea, nil or not.
If the argument idea is non-nil and therefore addresses an existing form,
then Cog sets the 'by' pointer of that form to the selfsame address, and
thus results in the form addressing itself by means of its own 'by' idea.

For example, if 'this' is a non-nil idea, then the effect of
carrying out cog (this) is indicated by the following figure:

o-------------o
|   o-----o   |
o-->|     |---o
    o-----o
    ^
cog |
    @

function cog (this: idea): idea;
begin
 cog := beset (this, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Nib.

Nib is a special constructor whose
end result is indicated as follows:

o-------------o
|   o-----o   |
o-->| ø 0 |---o
    o-----o
    ^
nib |
    @

function nib: idea;
begin
 nib := cog (dot)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Nob.

Nob is a special constructor whose
end result is indicated as follows:

o-------------o
|   o-----o   |
o-->|   0 |---o
    o-----o
    ^
nob |
    @

function nob: idea;
begin
 nob := cog (eye)
end;

Commentary Note • Bud, Nub, Cue, Key, Jog


Bud.

Bud is a function from characters to ideas.
It generates a Cog-type structure with the
argument character as the sign of its form.

For example, if mark = "a", then bud (mark)
is an initialized idea-form structure with
the letter "a" in the sign field and whose
'by' pointer points to its containing form:

o-------------o
|   o-----o   |
o-->| a 0 |---o
    o-----o
    ^
bud |
    @

function bud (mark: char): idea;
begin
 bud := cog (tag (mark))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Nub.

Nub is a function from ideas to ideas.
It initiates a Cog-structure that has
a given idea in the 'as' field of its
component form.

For example, if 'this' is given as the argument idea, whether
nil or otherwise, then nub (this) is an initialized idea-form
structure with the 'as' field of the form made equal to 'this'
and the 'by' field of the form set to contain its own address:

  ^ this
o--\----------o
|   o-----o   |
o-->|   0 |---o
    o-----o
    ^
nub |
    @

function nub (this: idea): idea;
begin
 nub := cog (tog (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Cue.

Cue is a function from ideas to ideas.
It initiates a Cog-structure that has
a given idea in the 'up' field of its
component form.

For example, if 'this' is given as the argument idea, whether
nil or otherwise, then cue (this) is an initialized idea-form
structure with the 'up' field of the form made equal to 'this'
and the 'by' field of the form set to contain its own address:

    ^ this
o---|---------o
|   o-----o   |
o-->| ø 0 |---o
    o-----o
    ^
cue |
    @

function cue (this: idea): idea;
begin
 cue := upset (nib, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Key.

Key is a function from ideas to ideas.
It initiates a Cog-structure that has
a given idea in the 'up' field of its
component form.

For example, if 'this' is given as the argument idea, whether
nil or otherwise, then key (this) is an initialized idea-form
structure with the 'up' field of the form made equal to 'this'
and the 'by' field of the form set to contain its own address:

    ^ this
o---|---------o
|   o-----o   |
o-->|   0 |---o
    o-----o
    ^
key |
    @

function key (this: idea): idea;
begin
 key := upset (nob, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Jog.

Jog is a transformation of ideas that acts as the identity on
the argument idea, nil or otherwise, but if the argument idea
is non-nil and therefore addresses an existing form, then Jog
increments the integer value in the 'code' field of this form
by a step of size one.

function jog (this: idea): idea;
begin
 jog := inset (this, anon (reck (this)))
end;

Commentary Note • Belong, Beside


Belong.

Belong is a function from "casts" and ideas to ideas.
A cast is a set of characters.  The functional value of
Belong is nil unless its argument idea addresses a form
whose 'sign' field bears a character that belongs to its
argument cast, in which case its functional value is equal
to its argument idea.  In other words, Belong functions as
a membership test for characters belonging to specified sets.

function belong (such: cast;
                 this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if arch (this) in such then here := this;
 belong := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Beside.

Beside is a function from "casts" and ideas to ideas.
A cast is a set of characters.  The functional value of
Beside is nil unless its argument idea addresses a form
whose 'sign' field has a character that does not belong
to its argument cast, in which case its functional value
is equal to its argument idea.  In other words, Beside is
a membership test for characters outside of specified sets.

function beside (such: cast;
                 this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if not (arch (this) in such) then here := this;
 beside := here
end;

Commentary Note • Class, Clash


Class.

Class is a transformation of ideas that acts as a special-purpose modifier.
If the argument idea is non-nil and therefore points to an existing form,
then Class resets the 'sign' field of this form in accord with a certain
semantic equivalence relation, specifically, one in which a comma is the
canonical sign for the semantic equivalence class {blank, enter, comma}
and a period is the canonical sign for the semantic equivalence class
{escap, ender, point}.  This function is used at several points in
the Theme One program by way of responding to command keystrokes
whose operational meanings are equivalent at those points.

function class (this: idea): idea;
begin
 class := this;
 if this <> nil then
  case arch (this) of
   blank, enter: this := scrip (this, comma);
   escap, ender: this := scrip (this, point)
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Clash.

Clash is a mapping from texts and ideas to (texts and) ideas that serves
as a special-purpose input-output echo.  If the argument idea is non-nil
and therefore points to an existing form, then Clash writes the canonical
representative of its 'sign' field to the argument text file, normally the
screen, in accord with the appropriate semantic equivalence relation, where
a left parenthesis is the canonical sign for the semantic equivalence class
{comma, left parenthesis} and a right parenthesis is the canonical sign for
the semantic equivalence class {period, right parenthesis}.  This function
is used at several points in the Theme One program to deal with command
keystrokes whose operational meanings are equivalent at those points.

function clash (var thou: text;
                    this: idea): idea;
begin
 clash := this;
 if this <> nil then
  case arch (this) of
   comma: this := pass (thou, links, this);
   point: this := pass (thou, right, this)
  end
end;

Commentary Note • Lief, Rest, Cope, Punt, Bank, Balk, Bark, Blur, Entab, Scape, Cleft, Grain, Crest, Glyph, Tare, Gram, Atom, Accept, Accede, Critic


Lief.

Lief is a transformation of ideas that functions as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea points to a form whose 'sign' field contains
a left parenthesis, in which case the argument idea is returned as
the functional value.

function lief (this: idea): idea;
begin
 lief := apt (links, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Rest.

Rest is a transformation of ideas that functions as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea points to a form whose 'sign' field contains
a right parenthesis, in which case the argument idea is returned as
the functional value.

function rest (this: idea): idea;
begin
 rest := apt (right, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Cope.

Cope is a transformation of ideas that functions as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea points to a form whose 'sign' field contains
a comma character, in which case the argument idea is passed along
as the functional value.

function cope (this: idea): idea;
begin
 cope := apt (comma, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Punt.

Punt is a transformation of ideas that functions as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea points to a form whose 'sign' field contains
a period (full stop), in which case the argument idea is returned as
the functional value.

function punt (this: idea): idea;
begin
 punt := apt (point, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Bank.

Bank is a transformation of ideas that functions as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea points to a form whose 'sign' field contains
a blank character, in which case the argument idea is passed through
as the functional value.

function bank (this: idea): idea;
begin
 bank := apt (blank, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Balk.

Balk is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea points to
an existing form whose 'sign' field contains either a blank character
or a left parenthesis, in which case the argument idea is returned as
the functional value.

function balk (this: idea): idea;
begin
 balk := belong ([blank, links], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Bark.

Bark is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea points to
an existing form whose 'sign' field contains either a blank character
or a right parenthesis, in which case the argument idea gets returned
as the functional value.

function bark (this: idea): idea;
begin
 bark := belong ([blank, right], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Blur.

Blur is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea points to
an existing form whose 'sign' field contains either a blank character,
a left parenthesis, or a right parenthesis, in which case the argument
idea is returned as the functional value.

function blur (this: idea): idea;
begin
 blur := belong ([blank, links, right], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Entab.

Entab is a transformation of ideas that serves as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea points to a form whose 'sign' field contains
a tab character, in which case the argument idea is returned as the
functional value.

function entab (this: idea): idea;
begin
 entab := apt (estab, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Scape.

Scape is a transformation of ideas that serves as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea points to a form whose 'sign' field contains
an escape character, in which case the argument idea is returned as
the functional value.

function scape (this: idea): idea;
begin
 scape := apt (escap, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Cleft.

Cleft is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea points to
a form whose 'sign' field bears either a comma or a left parenthesis,
in which case the argument idea is returned as the functional value.

function cleft (this: idea): idea;
begin
 cleft := belong ([comma, links], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Grain.

Grain is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea points to
an existing form whose 'sign' field bears something besides a comma
or a left parenthesis, in which case the argument idea is returned
as the functional value.

function grain (this: idea): idea;
begin
 grain := beside ([comma, links], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Crest.

Crest is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea points to
a form whose 'sign' field bears either a comma or a right parenthesis,
in which case the argument idea is returned as the functional value.

function crest (this: idea): idea;
begin
 crest := belong ([comma, right], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Glyph.

Glyph is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea points to
an existing form whose 'sign' field bears something besides a comma
or a right parenthesis, in which case the argument idea is passed
along as the functional value.

function glyph (this: idea): idea;
begin
 glyph := beside ([comma, right], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Tare.

Tare is a transformation of ideas that serves as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea addresses an existing form whose 'sign' field
contains a comma, a left parenthesis, or a right parenthesis, in which
case the argument idea "sifts through" to become the functional value.

function tare (this: idea): idea;
begin
 tare := belong ([comma, links, right], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Gram.

Gram is a transformation of ideas that serves as a special recognizer,
in effect, as a type of predicate.  Its functional value is a nil idea
unless its argument idea references a form whose 'sign' field contains
something besides a comma, a left parenthesis, or a right parenthesis,
in which case the argument idea "passes through the filter" to become
the functional value.

function gram (this: idea): idea;
begin
 gram := beside ([comma, links, right], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Atom.

Atom is a transformation of ideas that serves as a predicate recognizer.
Its functional value is a nil idea unless its argument idea points to
an existing form whose 'sign' field bears something besides a blank,
a comma, a left parenthesis, or a right parenthesis, in which case
the argument idea is returned as the functional value.

function atom (this: idea): idea;
begin
 atom := beside ([blank, comma, links, right], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Accept.

Accept is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea addresses a
form whose 'sign' field contains a blank, a comma, or a carriage return,
in which case the argument idea is passed along as the functional value.

function accept (this: idea): idea;
begin
 accept := belong ([blank, comma, enter], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Accede.

Accede is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea addresses a
form whose 'sign' field contains a blank or a carriage return, in which
case the argument idea is reported as the functional value.

function accede (this: idea): idea;
begin
 accede := belong ([blank, enter], this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Critic.

Critic is a transformation of ideas that acts as a predicate recognizer.
Its functional value is a nil idea unless its argument idea addresses a
form whose 'sign' field contains a comma or a period, in which case the
argument idea is returned as the functional value.

function critic (this: idea): idea;
begin
 critic := belong ([comma, point], this)
end;

Work Area 1

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

>>>

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

TOP.  Commentary Note

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Advice.

Advice is a transformation of ideas that funtions as
specialized modifier that is needed at 

function advice (this: idea): idea;
begin
 advice := critic (class (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Kind.

function kind (term: info): mode;
begin
 if term = 'log' then kind := null else kind := moot
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Render.

function render (this: idea): idea;
begin
 render := this;
 if this = nil then this := quash (this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Permit.

function permit (line: info;
                 this: idea): idea;
var here: idea;
begin
 here :=
  vid (pass (con, links + elide,
  dim (pass (con, links + blank + line + blank, lash (nil)))));
 repeat here := tip until advice (here) <> nil;
 here := render (accept (clash (con, here)));
 permit := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Prompt.

function prompt (line: info): idea;
begin
 prompt := permit (line, nil)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Recycle.

function recycle (this: idea): idea;
var here: idea;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Deposit.

function deposit (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then with this^ do
  begin
   here := by;
   if sign = links then on := recycle (on);
   dispose (this)
  end;
 deposit := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Recycle.

{ function recycle (this: idea): idea;
  var here: idea; }

begin { recycle }
 here := nil;
 if this <> nil then with this^ do
  begin
   here := by;
   if here <> nil then
    begin
     by := nil;
     repeat here := deposit (here)
      until here = nil
    end
  end;
 recycle := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Repose.

function repose (that, this: idea): idea;
begin
 repose := revert (recycle (that), this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Critique.

function critique (term: info;
                   this: idea): idea;
begin
 if term = 'lex' then writeln ('<* no direction home; please reset *>')
 else
 if term = 'lit' then
  write ('<* unknown word beginning with "', arch (this), '" *>')
 else
 if term = 'par' then write ('<* wrong parens *>');
 critique := just (turn (hold (this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Order.

function order (this: idea): idea;
var here, flag, menu, venu: idea;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Sort.

function sort (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := this;  there := this;
   repeat
    with there^ do
     begin
      if sign = links then on := sort (on);
      if here^.code < by^.code then here := by;
      there := by
     end
   until there = this
  end;
 sort := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Resort.

function resort (thus, that, this: idea): idea;
begin
 resort := this;
 if thus <> nil then with thus^ do on := sort (on);
 if that <> nil then with that^ do on := sort (on)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Free.

function free (this: idea): idea;
begin
 free := divert (this, covert (nigh (this), this))
end;

Commentary Note • Find


Find.

Find is a function from characters and ideas to ideas that operates on
the assumption that its input idea points to a form in a cycle of forms.
Its functional value is the address of the first form in the given cycle,
if any, starting with the indicated form, whose 'sign' field contains the
input character, otherwise it returns a value of nil.

The following figure illustrates a typical example,
where mark = "m", and the form after the ellipsis
is the first one that contains "m" as its 'sign'.

 o-------------------------------------------------o
 |   o-----o   o-----o         o-----o   o-----o   |
 o-->| a   |-->| b   |-->···-->| m   |-->| n   |---o
     o-----o   o-----o         o-----o   o-----o
     ^                         ^
this |                         | find ("m", this)
     @                         @

function find (mark: char;
               this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat here := apt (mark, there);
    there := next (there)
   until (here <> nil) or (there = this)
  end;
 find := here
end;

Commentary Note • Fore


Fore.

Fore is a transformation of ideas that operates on the
assumption that its argument idea references a form in
a cycle of forms.  Its functional value is the address
of the form that is immediately prior to this referent
form, as determined by the cyclic ordering in question.

In this setting a "cycle of forms" will always refer to a "by-cycle of forms",
that is, a finite set of forms that are linked by way of their 'by' addresses,
as illustrated in the following figure, where 'this' is the intended argument
and fore (this) is the computed result:

 o-------------------------------------------------o
 |   o-----o   o-----o         o-----o   o-----o   |
 o-->|     |-->|     |-->···-->|     |-->|     |---o
     o-----o   o-----o         o-----o   o-----o
     ^                                   ^
this |                                   | fore (this)
     @                                   @

function fore (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := this;
   repeat here := next (here)
    until next (here) = this
  end;
 fore := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Rise.

function rise (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := this;
   repeat here := fore (here)
    until crest (here) <> nil
  end;
 rise := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Fall.

function fall (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := this;
   repeat here := next (here)
    until crest (here) <> nil
  end;
 fall := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Prep.

function prep (mark: char;
               this: idea): idea;
var here, there, where: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat
    where := next (there);
    here := divert (apt (mark, where), there);
    there := where
   until (here <> nil) or (there = this)
  end;
 prep := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Last.

function last (this: idea): idea;
begin
 last := prep (right, this)
end;

Commentary Note • Suit


Suit.

Suit is a transformation of ideas that operates on the assumption that
its input idea points to a form in a cycle of forms.  Its functional
value is the address of the first form in the given cycle, if any,
starting with the indicated form, whose 'sign' field contains
a right parenthesis, otherwise it returns a value of nil.

The following figure illustrates a successful search:

 o-------------------------------------------------o
 |   o-----o   o-----o         o-----o   o-----o   |
 o-->| a   |-->| b   |-->···-->| m   |-->| )   |---o
     o-----o   o-----o         o-----o   o-----o
     ^                                   ^
this |                                   | suit (this)
     @                                   @

function suit (this: idea): idea;
begin
 suit := find (right, this)
end;

Commentary Note • Coup


Coup.

Coup is a transformation of ideas that operates on the assumption that
its input idea points to a form in a cycle of forms.  Its functional
value is the address of the next form after the first form in the
given cycle, if any, starting with the indicated form, whose
'sign' field contains a right parenthesis, otherwise it
returns a value of nil.

The following figure illustrates a typical result:

 o-------------------------------------------------o
 |   o-----o   o-----o         o-----o   o-----o   |
 o-->| a   |-->| b   |-->···-->| )   |-->| n   |---o
     o-----o   o-----o         o-----o   o-----o
     ^                                   ^
this |                                   | coup (this)
     @                                   @

function coup (this: idea): idea;
begin
 coup := next (suit (this))
end;

Commentary Note • Stem


Stem.

Stem is a transformation of ideas that operates on the assumption that its
argument idea points to a form in a cycle of forms.  It is composed of the
specialized search operation Suit followed by the 'on'-field selector Trip.
The following figure illustrates a typical situation in which Stem is used:

                         o-----o
    o--------------------|--o  |
    |  o---o  o---o  o---o  |  |
    o->| m |->| n |->| ) |--o  |
       o---o  o---o  o---o     |
       ^             ^         |
       |      o------|---------o
       |     /       |
  this |    /        | suit (this)
       |   /         @
       |  /
o------|-/---------------------o
|  o---o< o---o  o---o  o---o  |
o->| ( |->| a |->| b |->| c |--o
   o---o  o---o  o---o  o---o
   ^
   | stem (this)
   @

function stem (this: idea): idea;
begin
 stem := trip (suit (this))
end;

Commentary Note • Sequel


Sequel.

Sequel is a transformation of ideas that is composed of
the 'on'-field selector Trip followed by the specialized
search operation Suit.  The following figure illustrates
a typical situation in which Sequel is applied:

                              o-----o
         o--------------------|--o  |
         |  o---o  o---o  o---o  |  |
         o->| m |->| n |->| ) |--o  |
            o---o  o---o  o---o     |
            ^             ^         |
            |      o------|---------o
            |     /       |
trip (this) |    /        | sequel (this)
            |   /         @
            |  /
     o------|-/---------------------o
     |  o---o< o---o  o---o  o---o  |
     o->| ( |->| a |->| b |->| c |--o
        o---o  o---o  o---o  o---o
        ^
   this |
        @

function sequel (this: idea): idea;
begin
 sequel := suit (trip (this))
end;

Commentary Note • Coupon


Coupon.

Coupon is a transformation of ideas that is composed of
the 'on'-field selector Trip followed by the specialized
search operator Coup.  The following figure illustrates
a typical situation in which the Coupon operator applies:

                       o------------o
         o-------------|---------o  |
         |  o---o  o---o  o---o  |  |
         o->| m |->| ) |->| n |--o  |
            o---o  o---o  o---o     |
            ^             ^         |
            |      o------|---------o
            |     /       |
trip (this) |    /        | coupon (this)
            |   /         @
            |  /
     o------|-/---------------------o
     |  o---o< o---o  o---o  o---o  |
     o->| ( |->| a |->| b |->| c |--o
        o---o  o---o  o---o  o---o
        ^
   this |
        @

function coupon (this: idea): idea;
begin
 coupon := coup (trip (this))
end;

Commentary Note • Knap


Knap.

Knap is a transformation of ideas that acts as a predicate recognizer.
Its functional value is nil unless its argument idea points to a form
whose 'sign' field contains a right parenthesis and whose 'by'-field
addresses its own form, in which case the argument idea is returned
as the functional value.  The following figure shows the type of
configuration that is required for a non-nil result.

  o---------o
  |  o---o  |
  o->| ) |--o
     o---o
     ^
this | = knap (this)
     @

function knap (this: idea): idea;
begin
 knap := equity (next (this), rest (this))
end;

Commentary Note • Knot


Knot.

Knot is a transformation of ideas that acts as a predicate recognizer.
Its functional value is nil unless its argument idea points to a form
in a cycle of forms that has a form bearing a right parenthesis which
both precedes and follows the argument idea in the cycle of forms, in
which situation the argument idea is returned as the functional value.

The following two cases are the only ones that return
a non-nil result under ordinary circumstances of use:

Case 1.

     o---------o
     |  o---o  |
     o->| ) |--o
        o---o
        ^
   this | = knot (this)
        @

Case 2.

     o----------------o
     |  o---o  o---o  |
     o->|   |->| ) |--o
        o---o  o---o
        ^
   this | = knot (this)
        @

function knot (this: idea): idea;
begin
 knot := equity (this, equity (fore (suit (this)), next (suit (this))))
end;

Commentary Note • Respect


Respect.

Respect is a transformation of ideas that acts as a predicate recognizer.
Its functional value is nil unless its argument idea points to a form
whose 'sign' field contains a blank character and whose 'as'-field
is non-nil, in which case the argument idea is returned as the
functional value.  The following figure illustrates the case
of a non-nil result:

  ^ ante (this)
   \
  o-\-------o
  |  o---o  |
  o->|   |--o
     o---o
     ^
this | = respect (this)
     @

function respect (this: idea): idea;
begin
 respect := divert (ante (bank (this)), this)
end;

Nota Bene.  Respect = Vest.  This probably came about through
a form of convergent evolution when the Theme One program was
put together by integrating the parts of two earlier programs.

Commentary Note • Suspect


Suspect.

Suspect is a transformation of ideas that acts as a predicate recognizer.
Its functional value is nil unless all of the following conditions are
satisfied:  (1) The argument idea points to a form whose 'sign' field
contains a left parenthesis, (2) the Coupon of this argument idea is
non-nil, has a blank character in its 'sign' field, has a non-nil
idea in its 'as'-field, and is involved in a Knot configuration,
in which case the argument idea becomes the functional value.

The following figure illustrates the case of a non-nil result:

             o---o ^ ante (bank (coupon (lief (this))))
     o-------|---|--\--------o
     |   o---o   |   o---o   |
     o-->| ) |---|-->|   |---o
         o---o   |   o---o
         ^       |   ^
         |       |   | coupon (lief (this))
         |       |   @
 o-------|---o   |
 |   o---o   |   |
 o-->| ( |---o   |
     o---o<------o
     ^
this | = suspect (this)
     @

function suspect (this: idea): idea;
begin
 suspect := divert (knot (respect (coupon (lief (this)))), this)
end;

Commentary Note • Aspect


Aspect.

Aspect is a transformation of ideas that acts as a predicate recognizer.
Its functional value is nil unless its argument idea points to a form
at the root of either a Respect graph or a Suspect graph, in which
cases the argument idea is returned as the functional value.

Case 1.

      ^
    o--\--------o
    |   o---o   |
    o-->|   |---o
        o---o
        ^
   this | = respect (this)
        @

Case 2.
          ^             o-------o 
        o--\------------|---o   |
        |   o---o   o---o   |   |
        o-->|   |-->| ) |---o   |
            o---o   o---o       |
            ^                   |
            |   o---------------o
            |  /
    o-------|-/-o
    |   o---o<  |
    o-->| ( |---o
        o---o
        ^
   this | = suspect (this)
        @

function aspect (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if respect (this) <> nil then here := this
   else if suspect (this) <> nil then here := this;
 aspect := here
end;

Commentary Note • Apse


Apse.

Apse is a function from pairs of ideas to ideas that
acts as a specialized significance and equality test.
Its functional value is nil unless each of the two
argument ideas points to a form and each of these
forms has the same non-nil idea in its 'as'-field,
in which case the second argument idea is returned
as the functional value.

The following figure illustrates the case of a non-nil result:

   ^ ante (that) = ^ ante (this) =/= nil
    \               \
     o---o           o---o
     |   |           |   |
     o---o           o---o
     ^               ^
that |          this | = apse (that, this)
     @               @

function apse (that, this: idea): idea;
begin
 apse := divert (equity (ante (that), ante (this)), this)
end;

Commentary Note • Sape


Sape.

Sape is a function from pairs of ideas to ideas that
acts as a specialized significance and equality test.
Its functional value is nil unless each of the two
argument ideas points to an existing form and one
of the following two cases is true:  (1) both of
the forms bear the same Atom-type character in
their respective 'sign' fields, or (2) both of
the forms contain a blank character in their
respective 'sign' fields while bearing the
same non-nil idea in their 'as'-fields,
in which cases the functional value is
equal to the second argument idea.

Case 1.  atom (that) =/= nil.  arch (that) = arch (this).

        o---o           o---o
        | a |           | a |
        o---o           o---o
        ^               ^
   that |          this | = sape (that, this)
        @               @

Case 2.  arch (that) = arch (this) = blank.

      ^ ante (that) = ^ ante (this) =/= nil
       \               \
        o---o           o---o
        |   |           |   |
        o---o           o---o
        ^               ^
   that |          this | = sape (that, this)
        @               @

function sape (that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if atom (that) <> nil then here := rapt (that, this)
   else if bank (that) <> nil then here := apse (that, this);
 sape := here
end;

Commentary Note • Pase


Pase.

Pase is a function from pairs of ideas to ideas that
acts as a specialized significance and equality test.

The following figure illustrates the case of a non-nil result:

                  ^ ante (coupon (that))   =   ^ ante (coupon (this))
             o---o \                      o---o \
     o-------|---|--\--------o    o-------|---|--\--------o
     |   o---o   |   o---o   |    |   o---o   |   o---o   |
     o-->| ) |---|-->|   |---o    o-->| ) |---|-->|   |---o
         o---o   |   o---o            o---o   |   o---o
         ^       |   ^                ^       |   ^
         |       |   | coupon (that)  |       |   | coupon (this)
         |       |   @                |       |   @
         |       |                    |       |
 o-------|---o   |            o-------|---o   |
 |   o---o   |   |            |   o---o   |   |
 o-->| ( |---o   |            o-->| ( |---o   |
     o---o<------o                o---o<------o
     ^                            ^
that |                       this | = pase (that, this)
     @                            @

function pase (that, this: idea): idea;
begin
 pase :=
  divert (apse (
  coupon (suspect (that)),
  coupon (suspect (this))), this)
end;

Commentary Note • Apes


Apes.

Apes is a function from pairs of ideas to ideas that
acts as a specialized significance and equality test.
It computes the logical disjunction of the Sape test
and the Pase test, as shown in the following figures:

Case 1.  atom (that) =/= nil.  arch (that) = arch (this).

        o---o           o---o
        | a |           | a |
        o---o           o---o
        ^               ^
   that |          this | = apes (that, this)
        @               @

Case 2.  arch (that) = arch (this) = blank.

      ^ ante (that) = ^ ante (this) =/= nil
       \               \
        o---o           o---o
        |   |           |   |
        o---o           o---o
        ^               ^
   that |          this | = apes (that, this)
        @               @

Case 3.  pase (that, this) =/= nil.

                     ^ ante (coupon (that))   =   ^ ante (coupon (this))
                o---o \                      o---o \
        o-------|---|--\--------o    o-------|---|--\--------o
        |   o---o   |   o---o   |    |   o---o   |   o---o   |
        o-->| ) |---|-->|   |---o    o-->| ) |---|-->|   |---o
            o---o   |   o---o            o---o   |   o---o
            ^       |   ^                ^       |   ^
            |       |   | coupon (that)  |       |   | coupon (this)
            |       |   @                |       |   @
            |       |                    |       |
    o-------|---o   |            o-------|---o   |
    |   o---o   |   |            |   o---o   |   |
    o-->| ( |---o   |            o-->| ( |---o   |
        o---o<------o                o---o<------o
        ^                            ^
   that |                       this | = apes (that, this)
        @                            @

function apes (that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if sape (that, this) <> nil then here := this
   else if pase (that, this) <> nil then here := this;
 apes := here
end;

Commentary Note • Apes • Problem Flag


Apes.

At this point it seems to me like the intention of
Apes is meant to include a case like the following:

Case 4.
                o---o                        o---o
        o-------|---|-----------o    o-------|---|-----------o
        |   o---o   |   o---o   |    |   o---o   |   o---o   |
        o-->| ) |---|-->| a |---o    o-->| ) |---|-->| a |---o
            o---o   |   o---o            o---o   |   o---o
            ^       |   ^                ^       |   ^
            |       |   | coupon (that)  |       |   | coupon (this)
            |       |   @                |       |   @
            |       |                    |       |
    o-------|---o   |            o-------|---o   |
    |   o---o   |   |            |   o---o   |   |
    o-->| ( |---o   |            o-->| ( |---o   |
        o---o<------o                o---o<------o
        ^                            ^
   that |                       this | = apes (that, this)
        @                            @

I can't tell at present if this is an actual error in the code,
whether I'm misreading something now, or forgotten some detail,
so I will just forge ahead with the documentation effort until
I can see what's going on here.

Commentary Note • Like


Like.

Like is a function from pairs of ideas to ideas that serves as
a specialized search operation, working on the premiss that its
second argument idea, if significant, points to a form in a cycle
of forms.  Its functional value is nil unless the cycle contains
a form that Apes the form indicated by the first argument idea,
in which case the address of the first matching form in the
cycle is returned as the functional value.

The following figure illustrates one case of successful search:

                 o-----------------------------------------o
     o---o       |   o---o   o---o         o---o   o---o   |
     | m |       o-->| a |-->| b |-->···-->| m |-->| n |---o
     o---o           o---o   o---o         o---o   o---o
     ^               ^                     ^
that |          this |                     | like (that, this)
     @               @                     @

function like (that, this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat here := apes (that, there);
    there := next (there)
   until (here <> nil) or (there = this)
  end;
 like := here
end;

Commentary Note • Axil


Axil.

Axil is a transformation of ideas that is used to recognize
a couple of special-purpose configurations in cactus graphs.
It may be useful to work through the computation of Axil in
a step by step, case by case fashion.

Step 1.  The functional value of Axil (this) = nil unless
         Respect (this) is non-nil, as illustrated below:

            ^ ante (this) =/= nil
             \
              o---o
              |   | arch (this) = blank
              o---o
              ^
         this | = respect (this)
              @

Step 2.  Test the value of Equity (fore (this), next (this)).
         The following figures illustrate the possible cases:

Case 1.  this = fore (this) = next (this).

            ^
          o--\--------o
          |   o---o   |
          o-->|   |---o
              o---o
              ^
         this | = equity (fore (this), next (this))
              @

Case 2.  this =/= fore (this) = next (this).

            ^
          o--\----------------o
          |   o---o   o---o   |
          o-->|   |-->| x |---o
              o---o   o---o
              ^
         this | = equity (fore (this), next (this))
              @

Case 3.  equity (fore (this), next (this)) = nil.

            ^
          o--\------------------------------o
          |   o---o   o---o         o---o   |
          o-->|   |-->| x |-->···-->| y |---o
              o---o   o---o         o---o
              ^
         this |
              @

Step 3.  In Case 3, that is, if Equity (fore (this), next (this)) = nil,
         then Axil (this) = this.  In Cases 1 and 2, Axil (this) is set
         equal to Suspect (stem (this)), as shown in the figures below:

Case 1.  suspect (stem (this)) = nil,
         therefore axil (this) = nil.

Case 2.  The only way to obtain a non-nil result
         is with the following type of structure:

               ^             o-------o
             o--\------------|---o   |
             |   o---o   o---o   |   |
             o-->|   |-->| ) |---o   |
                 o---o   o---o       |
                 ^                   |
                 |      o------------o
                 |     /
            this |    /
                 |   /
                 |  /
         o-------|-/---------------o
         |   o---o<        o---o   |
         o-->| ( |-->...-->| x |---o
             o---o         o---o
             ^
             | axil (this)
             @

Case 3.  equity (fore (this), next (this)) = nil.

            ^
          o--\------------------------------o
          |   o---o   o---o         o---o   |
          o-->|   |-->| x |-->···-->| y |---o
              o---o   o---o         o---o
              ^
         this | = axil (this)
              @

function axil (this: idea): idea;
var here: idea;
begin
 here := nil;
 if respect (this) <> nil then
  begin
   here := covert (equity (fore (this), next (this)), this);
   if here = nil then here := suspect (stem (this))
  end;
 axil := here
end;

Commentary Note • Grasp


Grasp.

Grasp is a transformation of ideas that acts as a predicate recognizer,
in effect, computing the logical disjunction of the Grain test and the
Suspect test, with the non-nil cases as shown in the following figures:

Case 1.  grain (this) =/= nil.

              o---o
              | x | arch (this) not in {comma, left parenthesis}
              o---o  
              ^
         this |
              @

Case 2.  suspect (this) =/= nil.

                ^             o-------o
              o--\------------|---o   |
              |   o---o   o---o   |   |
              o-->|   |-->| ) |---o   |
                  o---o   o---o       |
                  ^                   |
                  |     o-------------o
                  |    /
                  |   /
                  |  /
          o-------|-/-------o
          |   o---o<        |
          o-->| ( |-->...---o
              o---o
              ^
         this |
              @

function grasp (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if grain (this) <> nil then here := this
   else if suspect (this) <> nil then here := this;
 grasp := here
end;

Commentary Note • Fret


Fret.

Fret is a transformation of ideas that acts as a predicate recognizer,
in effect, computing the logical conjunction of the Lief test and the
negation of the Suspect test, with the non-nil outcome as shown below:

     o---o
     | ( |
     o---o
     ^
this | =/= suspect (this)
     o

function fret (this: idea): idea;
var here: idea;
begin
 here := nil;
 if lief (this) <> nil then
  if suspect (this) = nil then here := this;
 fret := here
end;

Commentary Note • Deal


Deal.

Deal is a transformation of ideas that is used to navigate
cactus graphs in a particular manner, in effect, serving as
a conditional branch-on-test operation.  Its functional value
is nil unless its argument idea points to a form whose 'sign'
field bears something besides a comma or a right parenthesis.
If the 'sign' field bears a left parenthesis but is not the
root of a Suspect graph, then the address in the 'on' field
is returned as the functional value, otherwise, the address
of the next form in the cycle of forms is returned as the
functional value.  The following figures illustrate the
cases of a non-nil result:

Case 1.  glyph (this) =/= nil;  fret (this) =/= nil.

                  ^
                  | deal (this)
              o---o
              | ( |
              o---o
              ^
         this | =/= suspect (this)
              @

Case 2.  glyph (this) =/= nil;  fret (this) = nil.

              o---o deal (this)
              | x |------------>
              o---o
              ^
         this |
              @

function deal (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if glyph (this) <> nil then
   if fret (this) <> nil then here := trip (this)
    else here := next (this);
 deal := here
end;

Commentary Note • Lode


Lode.

Lode is a transformation of ideas that acts as a predicate recognizer,
in effect, computing the logical disjunction of the Gram test and the
Suspect test, with the non-nil results shown in the following figures:

Case 1.  gram (this) =/= nil.

              o---o
              | x | arch (this) not in {comma, links, right}
              o---o
              ^
         this | = gram (this)
              @

Case 2.  suspect this =/= nil.

                ^             o-------o
              o--\------------|---o   |
              |   o---o   o---o   |   |
              o-->|   |-->| ) |---o   |
                  o---o   o---o       |
                  ^                   |
                  |   o---------------o
                  |  /
          o-------|-/-------o
          |   o---o<        |
          o-->| ( |-->...---o
              o---o
              ^
         this | = suspect (this)
              @

function lode (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if gram (this) <> nil then here := this
   else if suspect (this) <> nil then here := this;
 lode := here
end;

Commentary Note • Lade


Lade.

Lade is a transformation of ideas that operates on
the premiss that its argument idea, if significant,
references a form in a cycle of forms.  It is used
to search the cycle in reverse order until finding
a form that passes the Lode test, in which case it
returns the address of the first such form, if any,
as its functional value, otherwise returning a nil.
The following figure illustrates a non-nil outcome:

 o-----------------------------------------o
 |   o---o   o---o         o---o   o---o   |
 o-->| a |-->| b |-->···-->| x |-->| y |---o
     o---o   o---o         o---o   o---o
     ^                     ^
this |                here | = lode (here) = lade (this)
     @                     @

function lade (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat there := fore (there);
    here := lode (there)
   until (here <> nil) or (there = this)
  end;
 lade := here
end;

Commentary Note • Lead


Lead.

Lead is a transformation of ideas that is used to navigate
a particular species of cactus graph in a particular manner.
The cases of a non-nil result are shown in the figures below:

Case 1.  grasp (this) =/= nil.
                                                 o-------o
                           o---------------------|---o   |
                           |   o---o         o---o   |   |
                           o-->| y |-->...-->| ) |---o   |
                               o---o         o---o       |
                               ^                         |
                               |      o------------------o
                               |     /
                          this |    /
                               |   /
                               |  /
         o---------------------|-/-o
         |   o---o         o---o<  |
         o-->| x |-->...-->| ( |---o
             o---o         o---o
             ^
             | lead (this) = lade (stem (this))
             @

Case 2.  grasp (this) = nil.

          o-------------------------------o
          |   o---o         o---o         |
          o-->| x |-->···-->| y |-->...---o
              o---o         o---o
              ^             ^
         this |             | lead (this) = lade (this)
              @             @

function lead (this: idea): idea;
begin
 lead := lade (upon (grasp (this), stem (this), this))
end;

Commentary Note • Joss


Joss.

Joss is a transformation of ideas that increments by
a step size of one the value of the 'code' field in
the Stem of a form

Case 1.  grasp (this) =/= nil.
                                         o-------o
               o-------------------------|---o   |
               |   o-----o         o-----o   |   |
               o-->| y i |-->...-->| ) j |---o   |
                   o-----o         o-----o       |
                   ^                             |
                   |      o----------------------o
                   |     /
              this |    /
                   |   /
                   |  /
         o---------|-/-o
         |   o-----o<  |
         o-->| ( k |---o
             o-----o
             ^
             | joss (this)
             @

Case 2.  grasp (this) = nil.

          o-----------o
          |   o---o   |
          o-->| x |-->o
              o---o
              ^
         this | = joss (this)
              @

function joss (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if grasp (this) <> nil then here := jog (stem (this))
   else here := this;
 joss := here
end;

Commentary Note • Jolt


Jolt.

function jolt (this: idea): idea;
begin
 jolt := jog (lade (joss (this)))
end;

Commentary Note • Graft


Graft.

Graft is function from pairs of ideas to ideas.
It operates on the assumption that it is given
a pair of Cog-type structures as its arguments.
If both ideas are nil, then their graft is nil.
If either one of them is nil, then their graft
is equal to the other one.  If it happens that
both ideas are significant, then we may depict
the input arguments in the manner that follows:

 o-------------o   o-------------o
 |   o-----o   |   |   o-----o   |
 o-->| a 1 |---o   o-->| b 2 |---o
     o-----o           o-----o
     ^                 ^
that |            this |
     @                 @

Tracing through the function definition, as it applies to this case,
should be enough to convince the reader that the functional outcome
will be an idea-form structure that has the following configuration:

 o-------------------------------o
 |   o-----o           o-----o   |
 o-->| a 1 |---------->| b 2 |---o
     o-----o           o-----o
                       ^
                 graft |
                       @

To see the general case, it helps to view things in the following way:

Step 1.  that, this <> nil

 o-------------------------------o   o-------------------------------o
 |   o-----o           o-----o   |   |   o-----o           o-----o   |
 o-->| a   |--> ··· -->| c   |---o   o-->| x   |--> ··· -->| z   |---o
     o-----o           o-----o           o-----o           o-----o
                       ^                                   ^
                  that |                              this |
                       @                                   @

Step 2.  here := that^.by

 o-------------------------------o   o-------------------------------o
 |   o-----o           o-----o   |   |   o-----o           o-----o   |
 o-->| a   |--> ··· -->| c   |---o   o-->| x   |--> ··· -->| z   |---o
     o-----o           o-----o           o-----o           o-----o
     ^                 ^                                   ^
here |            that |                              this |
     @                 @                                   @

Step 3.  that^.by := this^.by

                                     o-------------------------------o
     o-----o           o-----o       |   o-----o           o-----o   |
     | a   |--> ··· -->| c   |-------o-->| x   |--> ··· -->| z   |---o
     o-----o           o-----o           o-----o           o-----o
     ^                 ^                                   ^
here |            that |                              this |
     @                 @                                   @

Step 4.  this^.by := here

 o-------------------------------------------------------------------o
 |   o-----o           o-----o           o-----o           o-----o   |
 o-->| a   |--> ··· -->| c   |---------->| x   |--> ··· -->| z   |---o
     o-----o           o-----o           o-----o           o-----o
     ^                 ^                                   ^
here |            that |                              this |
     @                 @                                   @

Step 5.  graft := this

 o-------------------------------------------------------------------o
 |   o-----o           o-----o           o-----o           o-----o   |
 o-->| a   |--> ··· -->| c   |---------->| x   |--> ··· -->| z   |---o
     o-----o           o-----o           o-----o           o-----o
                                                           ^
                                                     graft |
                                                           @

function graft (that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if this = nil then here := that
  else
   begin
    if that <> nil then
     begin
      here := that^.by;
      that^.by := this^.by;
      this^.by := here
     end;
    here := this
   end;
 graft := here
end;

Commentary Note • Pinch


Pinch.

Pinch is a transformation of ideas that operates on the
assumption that its argument idea references a form in a
cycle of forms.  In such a setting it acts as the identity
on the argument idea but has the side-effect of isolating
the referent form and detaching it from its encyclement.
As usual, Pinch observes the rule "Nil In, Nil Out".

In this context a "cycle of forms" will always refer to a "by-cycle of forms",
that is, a finite set of forms that are linked by way of their 'by' addresses,
as illustrated in the following figure, where 'this' is the argument idea and
pinch (this) is the constructed result:

Before:  o---------------------------------o
         |   o-----o   o-----o   o-----o   |
         o-->| a 1 |-->| b 2 |-->| c 3 |---o
             o-----o   o-----o   o-----o
                          ^
                     this |
                          @

After:   o---------------------------------o
         |   o-----o             o-----o   |
         o-->| a 1 |------------>| c 3 |---o
             o-----o             o-----o

                   o-------------o
                   |   o-----o   |
                   o-->| b 2 |---o
                       o-----o
                          ^
             pinch (this) |
                          @

function pinch (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := beset (fore (this), next (this));
   here := cog (this)
  end;
 pinch := here
end;

Commentary Note • Switch


Switch.

Switch is a special constructor that
uses the special constructor Bud and
the generic constructor Peg to build
an idea-form structure of this shape:

                   o-------o
         o---------|---o   |
         |   o-----o   |   |
         o-->| ) 0 |---o   |
             o-----o       |
             ^             |
      switch |             |
             |             |
   o---------|---o         |
   |   o-----o   |         |
   o-->| ( 0 |---o         |
       o-----o<------------o

Observe that the idea returned as the functional value
is directed toward the form with the right parenthesis.

function switch: idea;
var here: idea;
begin
 here := bud (links);
 with here^ do
  begin
   on := peg (right, nil, nil, here, nil, 0);
   on^.by := on;
   here := on
  end;
 switch := here
end;

Commentary Note • Stitch


Stitch.

Stitch is a special constructor that
calls the special constructor Switch
followed up by the modifier function
Trip to build an idea-form structure
that has the following configuration:

                   o-------o
         o---------|---o   |
         |   o-----o   |   |
         o-->| ) 0 |---o   |
             o-----o       |
             ^             |
             |             |
             |             |
   o---------|---o         |
   |   o-----o   |         |
   o-->| ( 0 |---o         |
       o-----o<------------o
       ^
stitch |
       @

Notice that the idea returned as the functional value
is directed toward the form with the left parenthesis.

function stitch: idea;
begin
 stitch := trip (switch)
end;

Commentary Note • Splice


Splice.

Splice is a special constructor
whose end result has this shape:

   o-------------o
   |   o-----o   |
   o-->| , 0 |---o
       o-----o
       ^
splice |
       @

function splice: idea;
begin
 splice := bud (comma)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Work.

function work (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if lief (this) <> nil then here := this
   else if ante (this) <> nil then here := this;
 work := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Ease.

function ease (this: idea): idea;
var here, there, where: idea;
begin
 here := nil;
 if rest (this) <> nil then
  begin
   there := this;
   repeat there := next (there);
    where := work (there)
   until (where <> nil) or (there = this);
   here := covert (where, this)
  end;
 ease := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Edge.

function edge (this: idea): idea;
begin
 edge := divert (ease (sequel (lief (this))), this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Clue.

function clue (that, this: idea): idea;
begin
 clue := graft (nub (that), this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Recall.

function recall (var thou: text;
                     this: idea): idea;
forward;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Hark.

function hark (var thou: text;
                   this: idea): idea;
var here: idea;
begin
 hark := nil;
 if this <> nil then
  begin
   here := next (this);
   repeat here := next (here);
    if ante (here) = nil then here := part (thou, here)
     else here := obvert (here, recall (thou, ante (here)))
   until here = this;
   this := recycle (this)
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Back.

function back (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat there := lead (there);
    here := clue (there, here)
   until there = nil
  end;
 back := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Recall.

function recall { (var thou: text;
                       this: idea): idea };
var here: idea;
begin
 recall := this;
 if this <> nil then
  if tare (this) <> nil then here := hark (thou, back (this))
   else if bank (this) = nil then here := part (thou, this)
    else here := recall (thou, ante (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Call.

function call (this: idea): idea;
begin
 call := obvert (this, recall (con, ante (this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Recant.

function recant (var thou: text;
                     this: idea): idea;
begin
 recant :=
    pass (thou, blank + right,
  recall (thou, coupon (
    pass (thou, links, this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

State.

function state (var thou: text;
                    this: idea): idea;
var here: idea;
begin
 state := this;
 if this <> nil then
  if respect (this) <> nil then here := recall (thou, this)
   else if suspect (this) <> nil then here := recant (thou, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Claim.

function claim (this: idea): idea;
begin
 claim := state (con, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Recount.

function recount (var thou: text;
                      this: idea): idea;
var here: idea;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Harp.

function harp (var thou: text;
                   this: idea): idea;
begin
 harp := obvert (this, hark (thou, nigh (this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Beck.

function beck (this: idea): idea;
var here, there, where: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := nib;
   there := nil;  where := this;
   repeat where := lead (where);
    there := clue (where, there);
    here := jog (upset (here, there))
   until where = nil
  end;
 beck := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Recount.

{ function recount (var thou: text;
                        this: idea): idea;
  var here: idea; }

begin { recount }
 here := nil;
 if this <> nil then
  if tare (this) <> nil then here := harp (thou, beck (this))
   else if bank (this) = nil then here := part (thou, this)
    else here := recount (thou, ante (this));
 recount := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Counter.

function counter (var thou: text;
                      this: idea): idea;
begin
 counter :=
     pass (thou, blank + right,
  recount (thou, coupon (
     pass (thou, links, this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Issue.

function issue (var thou: text;
                    span: numb;
                    this: idea): idea;
var here: idea;
begin
 issue := this;
 if this <> nil then
  if respect (this) <> nil then
   here := skip (thou, span - reck (recount (thou, this)), this)
  else if suspect (this) <> nil then
   here := skip (thou, span - reck (counter (thou, this)) - 3, this)
end;

Commentary Note • List


List.

Step 1.
          o-------------------------------o
          |   o-----o           o-----o   |
          o-->|     |--> ··· -->|     |---o
              o-----o           o-----o
                                ^
                           this |               mark = "a"
                                @

Step 2.
          o-------------------------------o   o-------------o
          |   o-----o           o-----o   |   |   o-----o   |
          o-->|     |--> ··· -->|     |---o   o-->| a 0 |---o
              o-----o           o-----o           o-----o
                                ^                 ^
                           this |             bud |
                                @                 @

Step 3.
          o-------------------------------------------------o
          |   o-----o           o-----o           o-----o   |
          o-->|     |--> ··· -->|     |---------->| a 0 |---o
              o-----o           o-----o           o-----o
                                                  ^
                                             list |
                                                  @

function list (this: idea;
               mark: char): idea;
begin
 list := graft (this, bud (mark))
end;

Commentary Note • Roll


Roll.

Step 1.
          o-------------------------------o
          |   o-----o           o-----o   |
          o-->|     |--> ··· -->|     |---o
              o-----o           o-----o
                                ^                      ^
                           this |                 that |
                                @                      @

Step 2.
                                                ^ that
          o-------------------------------o   o--\----------o
          |   o-----o           o-----o   |   |   o-----o   |
          o-->|     |--> ··· -->|     |---o   o-->|   0 |---o
              o-----o           o-----o           o-----o
                                ^                 ^
                           this |             nub |
                                @                 @

Step 3.
                                                ^ that
          o--------------------------------------\----------o
          |   o-----o           o-----o           o-----o   |
          o-->|     |--> ··· -->|     |---------->|   0 |---o
              o-----o           o-----o           o-----o
                                                  ^
                                             roll |
                                                  @

function roll (this, that: idea): idea;
begin
 roll := graft (this, nub (that))
end;

Commentary Note • Image


Image.

Step 1.
                      o-------o
            o---------|---o   |   o-------------o
            |   o-----o   |   |   |   o-----o   |
            o-->| ) 0 |---o   |   o-->| a 1 |---o
                o-----o       |       o-----o
                ^             |       ^
         switch |             |  this |
                |             |       @
      o---------|---o         |
      |   o-----o   |         |
      o-->| ( 0 |---o         |
          o-----o<------------o

Step 2.
                      o-------o
            o---------|-------|-----------------o
            |   o-----o       |       o-----o   |
            o-->| ) 0 |-------|------>| a 1 |---o
                o-----o       |       o-----o
                ^             |       ^
                |             | graft |
                |             |       @
      o---------|---o         |
      |   o-----o   |         |
      o-->| ( 0 |---o         |
          o-----o<------------o

Step 3.
                      o-------o
            o---------|-------|-----------------o
            |   o-----o       |       o-----o   |
            o-->| ) 0 |-------|------>| a 1 |---o
                o-----o       |       o-----o
                ^             |
                |             |
                |             |
      o---------|---o         |
      |   o-----o   |         |
      o-->| ( 0 |---o         |
          o-----o<------------o
          ^
    image |
          @

function image (this: idea): idea;
begin
 image := stem (graft (switch, this))
end;

Commentary Note • Token


Token.

Token is a transformation of ideas that produces
a character-facsimile of its argument idea-form,
meanwhile leaving the argument structure intact.

Given an idea that refers to an existing form,
it constructs an initialized cog-type structure
that has the same character in its 'sign' field
as that of the indicated form.

Step 1.
              o-----o
              | a   |
              o-----o
              ^
         this |
              @

Step 2.
                            o-------------o
              o-----o       |   o-----o   |
              | a   |       o-->| a 0 |---o
              o-----o           o-----o
              ^                 ^
         this |           token |
              @                 @

function token (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then here := bud (arch (this));
 token := here
end;

Commentary Note • Tally


Tally.

Tally is a transformation of ideas that produces
a sign-&-code facsimile of its argument idea-form,
all the while leaving the argument structure intact.

Given an idea that refers to an existing form,
it constructs a cog-type structure that bears
the same character in its 'sign' field and
the same integer in its 'code' field as
that of the indicated form.

Step 1.
              o-----o
              | a 1 |
              o-----o
              ^
         this |
              @

Step 2.
                            o-------------o
              o-----o       |   o-----o   |
              | a 1 |       o-->| a 0 |---o
              o-----o           o-----o
              ^                 ^
         this |           token |
              @                 @

Step 3.
                            o-------------o
              o-----o       |   o-----o   |
              | a 1 |       o-->| a 1 |---o
              o-----o           o-----o
              ^                 ^
         this |           tally |
              @                 @

function tally (this: idea): idea;
begin
 tally := inset (token (this), reck (this))
end;

Commentary Note • Gist


Gist.

Gist is a transformation of ideas that produces
a sign-&-alias facsimile of its argument idea-form,
all the while leaving the argument structure intact.

Given an idea that refers to an existing form,
it constructs an initialized cog-type structure
that has the same character in the 'sign' field
and the same idea in the 'as' field as that of
the indicated form.

Step 1.
            ^ this^.as
             \
              o-----o
              | a   |
              o-----o
              ^
         this |
              @

Step 2.
            ^ this^.as
             \              o-------------o
              o-----o       |   o-----o   |
              | a   |       o-->| a 0 |---o
              o-----o           o-----o
              ^                 ^
         this |           token |
              @                 @

Step 3.
            ^ this^.as        ^ this^.as
             \              o--\----------o
              o-----o       |   o-----o   |
              | a   |       o-->| a 0 |---o
              o-----o           o-----o
              ^                 ^
         this |            gist |
              @                 @

function gist (this: idea): idea;
begin
 gist := asset (token (this), ante (this))
end;

Commentary Note • Gage


Gage.

Gage is a transformation of ideas that is composed of
the recognizer Gram followed by the constructor Gist.
Gram acts as the identity on any argument idea whose
form contains a 'sign' that is something other than
a comma, a left parenthesis, or a right parenthesis,
returning nil on anything else.  Gist constructs a
cog-type structure with the same 'sign' and 'alias'
as any significant idea-form that it gets as input.

Step 1.
            ^ this^.as
             \
              o-----o
              | a   |
              o-----o
              ^
         this |
              @

Step 2.  For "a" not equal to comma, left parens, right parens:

            ^ this^.as        ^ this^.as
             \              o--\----------o
              o-----o       |   o-----o   |
              | a   |       o-->| a 0 |---o
              o-----o           o-----o
              ^                 ^
         this |            gage |
              @                 @

function gage (this: idea): idea;
begin
 gage := gist (gram (this))
end;

Commentary Note • Gate


Gate.

Gate is a transformation of ideas that is used to copy cactus forms.
It constructs an Image of a sign-&-alias facsimile of a Gram node
in a pre-existing cactus form.  Recall that Gram nodes are those
that contain anything besides a comma, a left parenthesis, or
a right parenthesis in their 'sign' fields.

The following figures illustrate a typical application of Gate.

Step 1.
                        ^ ante (coupon (this))
                         \
                      o---\-------------o
        o-------------|----\--------o   |
        |   o---o   o---o   o---o   |   |
        o-->| p |-->| ) |-->| q |---o   |
            o---o   o---o   o---o       |
            ^               ^           |
            |      o--------|-----------o
            |     /         |
            |    /          | coupon (this)
            |   /           @
            |  /
    o-------|-/-------------------------o
    |   o---o<  o---o   o---o   o---o   |
    o-->| ( |-->| a |-->| b |-->| c |---o
        o---o   o---o   o---o   o---o
        ^
   this |
        @

Step 2.  For "q" not equal to comma, left parens, right parens:

                        ^ ante (coupon (this)) ^
                         \                      \
                      o---\-------------o        \
        o-------------|----\--------o   |      o--\--------o
        |   o---o   o---o   o---o   |   |      |   o---o   |
        o-->| p |-->| ) |-->| q |---o   |      o-->| q |---o
            o---o   o---o   o---o       |          o---o
            ^               ^           |          ^
            |      o--------|-----------o          |
            |     /         |                      |
            |    /          | coupon (this)        | gage (coupon (this))
            |   /           @                      @
            |  /
    o-------|-/-------------------------o
    |   o---o<  o---o   o---o   o---o   |
    o-->| ( |-->| a |-->| b |-->| c |---o
        o---o   o---o   o---o   o---o
        ^
   this |
        @

Step 3.
                     ^ ante (coupon (this))
                o---o \
        o-------|---|--\--------o
        |   o---o   |   o---o   |
        o-->| ) |---|-->| q |---o
            o---o   |   o---o
            ^       |   ^
            |       |   | gage (coupon (this))
            |       |   @
    o-------|---o   |
    |   o---o   |   |
    o-->| ( |---o   |
        o---o<------o
        ^
   gate |
        @

function gate (this: idea): idea;
begin
 gate := image (gage (coupon (this)))
end;

Commentary Note • Gauge


Gauge.

function gauge (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if gram (this) <> nil then here := gist (this)
   else if suspect (this) <> nil then here := gate (this);
 gauge := here
end;

Work Area 2 • Remainder of Program


Vest.

Vest is a transformation of ideas that serves as a predicate recognizer.
Its functional value is nil unless its argument idea points to a form
whose 'sign' field contains a blank character and whose 'as'-field
is non-nil, in which case the argument idea is returned as the
functional value.  The following figure illustrates the case
of a non-nil result:

  ^ ante (this)
   \
  o-\-------o
  |  o---o  |
  o->|   |--o
     o---o
     ^
this | = vest (this)
     @

function vest (this: idea): idea;
begin
 vest := divert (ante (bank (this)), this)
end;

Nota Bene.  Vest = Respect.  This probably came about through
a form of convergent evolution when the Theme One program was
put together by integrating the parts of two earlier programs.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Test.

function test (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if cope (this) <> nil then here := this
   else here := vest (this);
 test := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pend.

function pend (this: idea): idea;
begin
 pend := inset (gist (this), reck (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Mend.

function mend (this: idea): idea;
begin
 mend := pend (cope (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Vend.

function vend (this: idea): idea;
begin
 vend := pend (vest (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Tend.

function tend (this: idea): idea;
begin
 tend := pend (test (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Buff.

function buff (line: info): idea;
var here: idea;
    i, n: numb;
begin
 here := nil;  n := length (line);
 if n > 0 then
  begin
   here := nib;
   for i := 1 to n do here := list (here, line[i])
  end;
 buff := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Brush.

function brush (row, col: numb;
                    this: idea): idea;
var here: idea;
begin
 brush := this;
 if this <> nil then
  begin
   here := next (this);
   repeat here := part (con, at (row, anew (col), next (here)))
    until here = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Wend.

function wend (that, this: idea): idea;
var here: idea;
begin
 wend := this;
 if this <> nil then
  begin
   if that = nil then here := onset (this, this)
    else here := onset (that, onset (this, trip (that)));
   here := asset (ante (this), this)
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Past.

function past (this: idea): idea;
begin
 past := ante (ante (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Plot.

function plot (this: idea): idea;
begin
 plot := wend (past (this), this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Wink.

function wink (var thou: text): char;
begin
 wink := tap (thou);
 wink := blank
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Heed.

function heed (var thou: text): char;
var mark: char;
begin
 mark := tap (thou);
 case mark of
  enter: mark := wink (thou);
  ender: mark := blank
 end;
 heed := mark
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Bulk.

function bulk (mark: char): boolean;
begin
 bulk := mark in [blank, nul]
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Tack.

function tack (mark: char;
               this: idea): idea;
var here: idea;
begin
 here := nil;
 if lief (this) <> nil then
  begin
   here := sequel (this);
   if not bulk (mark) then here := find (mark, here)
  end
 else if cope (this) <> nil then
  if bulk (mark) then here := this;
 tack := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Spot.

function spot (var thou: text;
                   this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := this;
   repeat here := tack (heed (thou), next (here))
    until (crest (here) <> nil) or (here = nil);
   if here = nil then here := critique ('lit', this)
  end;
 spot := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Match.

function match (that, this: idea): idea;
var here, there: idea;
begin
 there := nil;
 if this <> nil then if that <> nil then
  begin
   here := next (next (this));
   there := tack (arch (here), that);
   while glyph (there) <> nil do
    begin
     here := next (here);
     there := tack (arch (here), next (there))
    end
  end;
 match := there
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Stock.

function stock: idea;
begin
 stock := image (stitch)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Clave.

function clave (var thou: text;
                    this: idea): idea;
var here: idea;
    name: info;
begin
 here := nil;  readln (name);
 if name = empty then here := stock
  else
   begin
    assign (thou, name);  reset (thou)
   end;
 clave := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Clepe.

function clepe (var thou: text;
                    this: idea): idea;
var name: info;
begin
 clepe := this;  readln (name);
 if name = empty then name := 'con';
 assign (thou, name);  rewrite (thou)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Compt.

function compt (var thou: text;
                    this: idea): idea;
begin
 compt := this;  close (thou)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Spell.

function spell (var thou: text): idea;
var here: idea;
    mark: char;
begin
 here := nil;
 repeat mark := tap (thou);
  case mark of
   links: here := trip (graft (here, inset (stitch, nip (thou))));
   right: if rest (next (here)) <> nil then
           here := trip (inset (next (here), nip (thou)))
          else here := critique ('lex', here);
   enter: mark := tap (thou);
   ender:
   else   here := inset (list (here, mark), nip (thou))
  end
 until mark = ender;
 spell := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Fetch.

function fetch (this: idea): idea;
var here: idea;
    thou: text;
begin
 here := nil;
 if this = nil then
  begin
   if prompt ('read lex file') <> nil then
    begin
     here := clave (thou, this);
     if here = nil then
      here := compt (thou, spell (thou))
    end
  end;
 fetch := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Chart.

function chart (var thou: text;
                    thus: mode;
                    this: idea): idea;
var here: idea;
    mark: char;
begin
 here := nil;
 repeat mark := tap (thou);
  case mark of
   links: here := trip (graft (here, inset (stitch, knab (thou, thus))));
   right: if rest (next (here)) <> nil then
           here := trip (inset (next (here), knab (thou, thus)))
          else here := critique ('par', here);
   comma: here := graft (here, inset (splice, knab (thou, thus)));
   enter: mark := tap (thou);
   blank, ender:
   else here := inset (plot (roll (here, spot (thou, tack (mark, this)))),
                       knab (thou, thus))
  end
 until mark = ender;
 chart := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Frame.

function frame (term: info;
                this: idea): idea;
var here: idea;
    thou: text;
begin
 here := nil;
 if this <> nil then
  if prompt ('read '+ term +' file') <> nil then
   begin
    here := clave (thou, here);
    if here = nil then
     here := compt (thou, chart (thou, kind (term), this))
   end;
 frame := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Stage.

function stage (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 there := fetch (nil);
 if there <> nil then
  begin
   there := graft (switch, sort (there));
   here := frame ('lit', there);
   if here <> nil then here := graft (there, sort (here))
  end;
 stage := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Clip.

function clip (var thou: text;
                    this: idea): idea;
forward;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Post.

function post (var thou: text;
                   this: idea): idea;
var here: idea;
begin
 post := this;
 if bank (this) <> nil then here := recall (thou, ante (this));
 here := pose (thou, this);
 if lief (this) <> nil then here := clip (thou, sequel (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Clip.

function clip { (var thou: text;
                     this: idea): idea };
var here: idea;
begin
 clip := this;
 if this <> nil then
  begin
   here := this;
   repeat here := post (thou, next (here))
    until here = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Save.

function save (this: idea): idea;
var thou: text;
begin
 save := turn (compt (thou, clip (thou, clepe (thou, this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Show.

function show (this: idea): idea;
begin
 show := clip (con, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Tell.

function tell (this: idea): idea;
begin
 tell := next (show (fore (this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Site.

function site (var thou: text;
                   this: idea): idea;
var here: idea;
begin
 site := this;
 if this <> nil then
  if atom (this) <> nil then here := part (thou, this)
   else if ante (this) <> nil then
    begin
     if crest (this) <> nil then here := pass (thou, quote, this);
     here := recall (thou, ante (this))
    end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Toss.

function toss (  var thou: text;
               that, this: idea): idea;
begin
 toss := this;  write (thou, seg (that^) : 8, ofs (that^) : 2)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Dump.

function dump (this: idea): idea;
var here: idea;
begin
 dump := this;
 if this <> nil then
  begin
   here := this;
   repeat here := next (here);
    here :=
     turn (
     site (con, skip (con, 4, score (con, 8,
     toss (con, next (here),
     toss (con, trip (here),
     toss (con, ante (here),
     pass (con, arch (here),  skip (con, 4,
     toss (con, here, here))))))))));
    if lief (here) <> nil then
     here := obvert (here, dump (sequel (here)))
   until here = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Index.

function index (this: idea): idea;
var here, lex, lit: idea;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Diag.

function diag (span: numb;
               this: idea): idea;
begin
 diag := at (span, span, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Bias.

function bias (that, this: idea): idea;
begin
 bias := diag (reck (that), this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Cant.

function cant (this: idea): idea;
begin
 cant := diag (reck (this), this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Dent.

function dent (that, this: idea): idea;
begin
 dent := diag (anon (reck (that)), this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Bent.

function bent (that, this: idea): idea;
var span: numb;
begin
 span := anon (reck (that));
 bent := at (span, span + reck (this), this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Kern.

function kern (that, this: idea): idea;
var here: idea;
begin
 kern := this;
 if this <> nil then
  if atom (this) <> nil then here := bent (that, this)
   else here := dent (this, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Wash.

function wash (size: numb;
         that, this: idea): idea;
var row, span: numb;
begin
 wash := this;
 span := reck (that);
 if atom (this) <> nil then this := dash (this)
  else for row := size downto span do this := dash (diag (row, this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Gnash.

function gnash (this: idea): idea;
begin
 gnash := dash (dent (this, nil))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Fresh.

function fresh (tab: numb;
         that, this: idea): idea;
var span: numb;
begin
 span := reck (that);
 fresh := at (span, span + tab, this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Scion.

function scion (this: idea): idea;
begin
 scion := graft (gist (this), splice)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Split.

function split (this: idea): idea;
var here: idea;
begin
 here := nil;
 if cope (this) <> nil then
  here :=
   onset (scrip (this, links),
   onset (scrip (pend (this), right), this));
 split := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Scale.

function scale (that, this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if cope (that) <> nil then
  begin
   there := graft (split (that), splice);
   here := graft (stitch, graft (trip (that), this))
  end;
 scale := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pod.

function pod (that, this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := this;
   there := fret (nigh (that));
   if there <> nil then
    here := upset (this, next (like (this, trip (there))));
   here := inset (this, anon (reck (that)))
  end;
 pod := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Note.

function note (that, this: idea): idea;
begin
 note := graft (that, pod (that, this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Clef.

function clef (this: idea): idea;
begin
 clef := gauge (deal (nigh (this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Plant.

function plant (this: idea): idea;
var here: idea;
begin
 plant := this;
 if cleft (this) <> nil then
  begin
   here := this;
   repeat here := jolt (here)
    until here = nil
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Reward.

function reward (this: idea): idea;
begin
 reward := obvert (this, plant (nigh (this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Place.

function place (this: idea): idea;
var here: idea;
begin
 place := this;
 if cleft (this) <> nil then
  begin
   here := this;
   repeat here := deal (jog (here))
    until here = nil
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Credit.

function credit (this: idea): idea;
begin
 credit := obvert (this, place (nigh (this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Plait.

function plait (that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if lief (that) <> nil then
  here := graft (fore (last (trip (that))), this)
 else if cope (that) <> nil then here := scale (that, this);
 plait := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Plight.

function plight (that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if that <> nil then
  if this = nil then here := that
   else here := upset (this, plait (nigh (that), scion (this)));
 plight := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pledge.

function pledge (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := this;
   repeat there := free (next (here));
    here := plight (here, there)
   until there = nil
  end;
 pledge := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Trunk.

function trunk (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if nigh (this) <> nil then here := this
   else if nigh (next (this)) <> nil then
    begin
     here := this;
     repeat here := next (here)
      until nigh (next (here)) = nil
    end;
 trunk := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Stash.

function stash (this: idea): idea;
var here: idea;
begin
 stash := this;
 if this <> nil then
  begin
   here := trunk (this);
   if here <> this then here := pledge (here);
   here := credit (reward (here))
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Stake.

function stake (this: idea): idea;
var here: idea;
begin
 stake := this;
 if this <> nil then
  if rest (this) <> nil then here := pass (con, point, this)
   else here := claim (this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Spate.

function spate (var thou: text;
                    this: idea): idea;
begin
 spate := spin (thou, space (thou, this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Ratio.

function ratio (var thou: text;
        thus, that, this: idea): idea;
var nom, num: numb;
begin
 ratio := this;
 nom := reck (thus);  num := reck (that);
 if nom > 0 then write (thou, num / nom :3:2)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Log2.

function log2 (what: real): real;
begin
 log2 := ln (what) / ln (2)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Doubt.

function doubt (var thou: text;
        thus, that, this: idea): idea;
var nom, num: numb;
begin
 doubt := this;
 nom := reck (thus);  num := reck (that);
 if nom > 0 then if num > 0 then
  write (thou, (num / nom) * log2 (nom / num) :4:3)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Spark.

function spark (that, this: idea): idea;
begin
 spark := dash (spate (con, fresh (40, that, dash (this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Glint.

function glint (when, thus, that, this: idea): idea;
begin
 glint :=
  doubt (con, thus, that, fresh (60, when,
  ratio (con, thus, that, fresh (50, when, this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Blaze.

function blaze (thus, that, this: idea): idea;
var here: idea;
begin
 blaze := this;
 if this <> nil then
  if atom (that) <> nil then here := part (con, gram (this))
   else if blur (this) <> nil then
    here :=
     glint (thus, nigh (that), this,
     spark (thus, stake (bias (thus, this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Gloss.

function gloss (this: idea): idea;
var here, there: idea;
begin
 gloss := this;
 if this <> nil then
  if atom (this) <> nil then here := part (con, this)
   else if balk (this) <> nil then
    begin
     there := nigh (claim (cant (this)));
     here :=
      dent  (this,
      glint (this, stem (there), there,
      spark (this, there)))
    end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Guess.

function guess (that, this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if that <> nil then
  begin
   here := tally (that);
   if this <> nil then
    begin
     there := this;
     repeat there := deal (there);
      if there <> nil then
       there := deal (blaze (jog (here), that, there))
     until there = nil
    end
  end;
 guess := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Trace.

function trace (thus, that, this: idea): idea;
begin
 trace := kern (thus, wash (size, jog (guess (that, this)), that))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Sketch.

function sketch (thus, that, this: idea): idea;
begin
 sketch := obvert (this, trace (thus, that, this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Glance.

function glance (that, this: idea): idea;
begin
 glance := obvert (this, trace (that, this, nigh (this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Flash.

function flash (that, this: idea): idea;
begin
 flash := kern (that, vid (glance (that, dim (gloss (this)))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Reach.

function reach (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat there := next (there);
    here := grasp (there)
   until (here <> nil) or (there = this)
  end;
 reach := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pick.

function pick (thus, that, this: idea): idea;
var here, there, where: idea;
begin
 here := nil;
 if lief (this) <> nil then
  begin
   here := this;
   there := trip (here);  where := nil;
   repeat
    here := sketch (thus, that, onset (here, reach (there)));
    there := trip (here);  where := tip
   until punt (where) = nil;
   if accept (where) <> nil then here := gauge (there) else here := nil
  end;
 pick := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Play.

function play (that, this: idea): idea;
begin
 play := vid (pick (that, this, dim (nigh (this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Track.

function track (this: idea): idea;
var here: idea;
begin
 track := this;
 if this <> nil then
  begin
   here := this;
   repeat here := gloss (next (here))
    until here = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Thrash.

function thrash (this: idea): idea;
begin
 thrash := kern (this, vid (glance (this, dim (track (this)))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Renumb.

function renumb (this: idea): idea;
var here: idea;
    span: numb;
begin
 renumb := this;
 if this <> nil then
  begin
   here := this;  span := 0;
   repeat here := next (inset (here, anew (span)))
    until here = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Regard.

function regard (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if bank (this) <> nil then
  begin
   there := axil (this);
   repeat here := graft (upset (gauge (there), next (there)), here);
    there := lead (there)
   until there = nil
  end;
 regard := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Review.

function review (this: idea): idea;
begin
 review := fore (renumb (next (regard (this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Thresh.

function thresh (this: idea): idea;
var here, there, where, thus: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := ante (this);
   if there <> nil then
    repeat where := ante (there);
     here := thrash (review (where));  thus := tip;
     if entab (thus) <> nil then there := asset (there, trip (where))
    until entab (thus) = nil
  end;
 thresh := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Summary.

function summary (this: idea): idea;
var thou: text;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Detail.

function detail (var thou: text;
                      tab: numb;
               that, this: idea): idea;
begin
 detail :=
  return (thou,
   doubt (thou, that, this, skip (thou, 8,
   ratio (thou, that, this, skip (thou, 8,
   score (thou, 8,
   issue (thou, trim - tab, skip (thou, tab, this))))))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Report.

function report (var thou: text;
                      tab: numb;
                     this: idea): idea;
var here, there: idea;
begin
 report := this;
 if this <> nil then
  begin
   there := this;
   repeat
    if aspect (there) <> nil then
     here := detail (thou, tab, stem (this), there)
    else if lief (there) <> nil then
     here := report (thou, anon (tab), trip (there));
    there := next (there)
   until there = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Summary.

{ function summary (this: idea): idea;
  var thou: text; }

begin { summary }
 summary := compt (thou, report (thou, 0, clepe (thou, this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Patch.

function patch (this: idea): idea;
begin
 patch := call (at (24, 1, this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Catch.

function catch (term, line: info;
                that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then if that <> nil then
  if match (that, buff (term)) = this then
   if prompt (line) <> nil then here := this;
 catch := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pitch.

function pitch (menu, lit, this: idea): idea;
var here, thus, lex: idea;
begin
 here := nil;
 if this <> nil then if lit <> nil then
  begin
   thus := ante (this);  lex := fore (lit);
   if catch ('index', 'return to index', menu, thus) <> nil
    then here := flag
    else
     begin
      if catch ('sort', 'sort index', menu, thus) <> nil
       then here := wait (tort (resort (lex, lit, nil)))
      else if catch ('check', 'check memory', menu, thus) <> nil
       then here := hold (space (con, tort (check (nil))))
      else if catch ('summary', 'write summary file', menu, thus) <> nil
       then here := hold (graft (lex, summary (pinch (lit))))
      else if catch ('show', 'show index', menu, thus) <> nil
       then here := hold (turn (show (turn (stem (lit)))))
      else if catch ('dump', 'dump index', menu, thus) <> nil
       then here := hold (dump (turn (stem (lit))));
      here := nil
     end
  end;
 pitch := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Craft.

function craft (that, this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := flash (that, this);
   repeat there := tip;
    case arch (there) of
     escap, ender: here := nil;
     elide, erase,
     links, right: here := gnash (that);
     blank, enter: here := stash (glance (that, here));
     comma:        here := note (here, gloss (clef (here)));
     point:        here := note (here, gloss (play (that, here)))
     else          here := flash (that, note (here, token (there)))
    end
   until (accede (there) <> nil) or (here = nil)
  end;
 craft := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Effect.

function effect (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat here := crest (there);
    there := deal (there)
   until (here <> nil) or (there = nil)
  end;
 effect := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Upshot.

function upshot (this: idea): idea;
begin
 upshot := effect (nigh (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Nudge.

function nudge (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then here := nub (this);
 nudge := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Hint.

function hint (thus, that, this: idea): idea;
begin
 hint := nudge (upshot (craft (thus, note (that, this))))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Mote.

function mote (thus, that, this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if lief (this) <> nil then
   begin
    here := dash (part (con, this));
    here := image (hint (thus, cue (that), token (tip)))
   end
  else here := hint (thus, cue (that), token (this));
 mote := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Draft.

function draft (menu, lit, that, this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := flash (clear (nil), key (this));
   repeat there := tip;
    case arch (there) of
     enter: here := flash (nil, here);
     comma: here := gloss (note (here, clef (here)));
     point: here := gloss (note (here, play (nil, here)));
     estab: here := flash (nil, graft (key (this), thresh (here)));
     blank: here := pitch (menu, lit, patch (stash (glance (nil, here))));
     escap, ender, elide, erase, right: here := nil;
     else   here := flash (nil, note (here, mote (here, that, there)))
    end
   until (here = flag) or (here = nil)
  end;
  if scape (there) = nil then if here <> flag then here := this;
 draft := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Index.

{ function index (this: idea): idea;
  var here, lex, lit: idea; }

begin { index }
 index := this;
 here := turn (nil);
 lit := stage (here);  lex := fore (lit);
 if lit <> nil then
  begin
   repeat
    repeat
     repeat here := draft (menu, lit, lex, lit)
      until here = nil;
     if permit ('sort index', clear (nil)) <> nil then
      here := turn (tort (resort (lex, lit, nil)))
    until prompt ('return to index') = nil;
    repeat here := draft (menu, lit, menu, venu)
     until (here = flag) or (here = nil);
   until here = clear (nil);
   repeat
    if prompt ('write lex file') <> nil then lex := save (pinch (lex));
    if prompt ('write lit file') <> nil then lit := save (pinch (lit))
   until prompt ('quit') <> nil
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Study.

function study (this: idea): idea;
var here, i, now, lex, log: idea;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Scene.

function scene (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then here := frame ('log', this);
 if here  = nil then here := frame ('num', this);
 scene := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Query.

function query (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  begin
   write   ('< enter lines of inquiry >');
   writeln ('< press control-z to end >' : 54);  reset (con);
   here := chart (con, kind ('log'), this);    rewrite (con)
  end;
 query := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Fake.

function fake (this: idea): idea;
forward;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Twin.

function twin (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  if lief (this) <> nil then here := image (fake (sequel (this)))
   else if rest (this) = nil then here := pend (this);
 twin := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Fake.

function fake { (this: idea): idea };
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat there := next (there);
    here := graft (here, twin (there))
   until there = this
  end;
 fake := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Mock.

function mock (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   there := this;
   repeat there := next (there);
    case arch (there) of
     links: begin
             here := trip (graft (here, inset (stitch, reck (there))));
             there := sequel (there)
            end;
     right: if rest (next (here)) <> nil then
             begin
              here := trip (inset (next (here), reck (there)));
              there := trip (there)
             end
            else here := critique ('par', here);
     comma: here := graft (here, pend (there))
     else   here := graft (here, plot (pend (there)))
    end
   until there = this
  end;
 mock := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Seal.

function seal (this: idea): idea;
var here: idea;
begin
 seal := this;
 if this <> nil then
  begin
   here := this;
   repeat
    with here^ do
     begin
      if sign = right then as := nil
       else if sign = links then here := seal (on);
      here := by
     end
   until here = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Dupe.

function dupe (thus, this: idea): idea;
var here: idea;
begin
 here := nil;
 if thus <> nil then if this <> nil then
  begin
   thus := seal (thus);
   here := mock (this)
  end;
 dupe := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Face.

function face (this: idea): idea;
var here: idea;
   depth: numb;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Mood.

function mood (this: idea): mode;
var here: mode;
begin
 here := null;
 if this <> nil then
  if lief (this) <> nil then here := moot
   else if ante (bank (this)) <> nil then here := firm;
 mood := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Look.

function look (this: idea): idea;
var here: idea;
begin
 here := nil;
 if this <> nil then
  begin
   here := this;
   repeat here := next (here);
    until (ante (here) <> nil) or (here = this);
   if ante (here) = nil then here := find (links, this)
  end;
 look := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

View.

function view (this: idea;
              depth: numb): idea;
var here, there: idea;
begin
 here := nil;
 if this <> nil then
  begin
   if depth = 1 then here := look (this)
    else
     begin
      there := this;
      repeat there := next (there);
       here := view (trip (lief (there)), alow (depth))
      until (mood (here) = firm) or (there = this);
      if mood (here) = null then
       repeat there := next (there);
        here := view (trip (lief (there)), alow (depth))
       until (mood (here) = moot) or (there = this)
     end
  end;
 view := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Face.

{ function face (this: idea): idea;
  var here: idea;
     depth: numb; }

begin { face }
 here := nil;
 if this <> nil then
  begin
   depth := 0;
   repeat here := view (this, anew (depth))
    until mood (here) <> moot;
   if mood (here) = null then here := nil
  end;
 face := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Impost.

 function impost (this: idea): idea;
 var here, there: idea;
 begin
  here := nil;
  if this <> nil then
   begin
    there := this;
    repeat there := next (there);
     here := edge (there)
    until (here <> nil) or (there = this)
   end;
  impost := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Invest.

 function invest (that, this: idea): idea;
 var here, there: idea;
 begin
  here := nil;
  if this <> nil then
   begin
    there := this;
    repeat there := next (there);
     here := equity (that, ante (there))
    until (here <> nil) or (there = this)
   end;
  invest := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Purport.

 function purport (this: idea): idea;
 var here: idea;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Import.

 function import (this: idea): idea;
 var here, there, where: idea;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Impact.

 function impact (thus, this: idea): idea;
 var here, there, where: idea;
 begin
  here := nil;
  if this <> nil then if thus <> nil then
   if rest (this) <> nil then
    begin
     there := fall (thus);  where := rise (thus);
     while there <> where do
      begin
       there := next (there);
       if lief (there) <> nil then
        here := graft (here, import (there))
       else if crest (there) = nil then
        here := graft (here, pend (there))
      end
    end;
  impact := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Import.

 { function import (this: idea): idea;
   var here, there, where: idea; }

 begin { import }
  here := nil;
  if this <> nil then
   if lief (this) <> nil then
    begin
     there := sequel (this);  where := impost (there);
     if where <> nil then here := purport (impact (where, there))
      else
       begin
        here := image (purport (there));
        there := sequel (here);  where := impost (there);
        if where <> nil then here := purport (impact (where, there))
       end
    end
   else if rest (this) = nil then here := pend (this);
  import := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Impute.

 function impute (this: idea): idea;
 var here, there, where: idea;
 begin
  here := nil;
  if this <> nil then
   begin
    there := this;
    repeat there := next (there);
     here := graft (here, import (there));
     where := edge (here)
    until (where <> nil) or (there = this);
    if where <> nil then here := stitch
   end;
  impute := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Comport.

 function comport (this: idea): idea;
 var here, there: idea;
 begin
  here := nil;
  if this <> nil then
   begin
    there := this;
    repeat there := next (there);
     here := graft (here, import (there))
    until there = this
   end;
  comport := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Purport.

 { function purport (this: idea): idea;
   var here: idea; }

 begin { purport }
  here := nil;
  if this <> nil then
   if find (comma, this) <> nil then here := comport (this)
    else if impost (this) <> nil then here := stitch
     else here := impute (this);
  purport := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Purpose.

 function purpose (this: idea): idea;
 begin
  purpose := repose (this, purport (this))
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Stone.

 function stone (that, this: idea): idea;
 var here, there: idea;
 begin
  here := nil;
  if this <> nil then
   if that = nil then here := fake (this)
    else
     begin
      there := this;
      repeat there := next (there);
       if lief (there) <> nil then
        here := graft (here, image (stone (that, trip (there))))
       else if ante (there) <> that then here := graft (here, tend (there))
      until there = this
     end;
  stone := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Stick.

 function stick (that, this: idea): idea;
 var here, there: idea;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Stirp.

 function stirp (thus, that, this: idea): idea;
 var here: idea;
 begin
  here := thus;
  if this <> nil then
   if lief (this) <> nil then
    here := graft (here, image (stick (that, trip (this))))
   else here := graft (here, tend (this));
  stirp := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Stipe.

 function stipe (that, this: idea): idea;
 var here, there: idea;
 begin
  here := nil;
  if this <> nil then
   begin
    there := this;
    repeat there := next (there);
     here := stirp (here, that, there)
    until there = this
   end;
  stipe := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Stile.

 function stile (that, this: idea): idea;
 var here, there: idea;
 begin
  here := nil;
  if this <> nil then
   begin
    there := this;
    repeat there := next (there);
     if ante (there) = that then here := graft (here, stitch)
      else here := stirp (here, that, there)
    until there = this
   end;
  stile := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Stick.

 { function stick (that, this: idea): idea;
   var here, there: idea; }

 begin { stick }
  here := nil;
  if this <> nil then
   if that = nil then here := fake (this)
    else if find (comma, this) <> nil then here := stile (that, this)
     else
      begin
       there := invest (that, this);
       if there <> nil then here := stitch;
       if here = nil then here := stipe (that, this)
      end;
  stick := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Model.

 function model (this: idea): idea;
 var here, there: idea;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Figure.

 function figure (that, this: idea): idea;
 begin
  figure :=
   graft (switch,
   graft (nub (that),
   model (stone (that, this))))
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Ground.

 function ground (that, this: idea): idea;
 begin
  ground :=
   graft (splice,
   graft (image (nub (that)),
   model (stick (that, this))))
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Gestalt.

 function gestalt (that, this: idea): idea;
 begin
  gestalt :=
   stem (graft (
   figure (that, this),
   ground (that, this)))
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Model.

 { function model (this: idea): idea;
   var here, there: idea; }

 begin { model }
  here := memcheck (nil);
  if this <> nil then
   begin
    here := purpose (this);  there := ante (face (here));
    if there <> nil then here := repose (here, gestalt (there, here))
   end;
  model := here
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Affirm.

 function affirm (var thou: text;
                      this: idea): idea;
 begin
  affirm := verse (thou, blank + aster, this)
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Refute.

 function refute (var thou: text;
                      this: idea): idea;
 begin
  refute := verse (thou, blank + minus, this)
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Reject.

 function reject (var thou: text;
                      what: mode;
                      this: idea): idea;
 var here: idea;
 begin
  reject := this;
  if what = null then here := refute (thou, this)
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Outline.

 function outline (what: mode;
                   this: idea): idea;
 var thou: text;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Circuit.

 function circuit (var thou: text;
                        tab: numb;
                       what: mode;
                       this: idea): idea;
 var here: idea;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Feature.

 function feature (var thou: text;
                        tab: numb;
                       what: mode;
                       this: idea): idea;
 var here: idea;
 begin
  feature := this;
  if this <> nil then
   if what <> firm then
    begin
     here := state (thou, skip (thou, tab, this));
     if crest (next (this)) <> nil then here := affirm (thou, this)
      else if edge (next (this)) = nil then here := return (thou, this)
    end
   else if respect (this) <> nil then
    here := return (thou, recall (thou, skip (thou, tab, this)))
 end;

 o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

 Compass.

 function compass (var thou: text;
                        tab: numb;
                       what: mode;
                       this: idea): idea;
 var here: idea;
 begin
  compass := this;
  if this <> nil then
   if rest (next (cope (this))) <> nil then
    here := affirm (thou, skip (thou, tab, this))
   else if aspect (this) <> nil then
    here := feature (thou, tab, what, this)
   else if lief (this) <> nil then
    if edge (this) <> nil then here := reject (thou, what, this)
     else here := circuit (thou, anon (tab), what, sequel (this))
 end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Circuit.

{ function circuit (var thou: text;
                         tab: numb;
                        what: mode;
                        this: idea): idea;
  var here: idea; }

begin { circuit }
 circuit := this;
 if this <> nil then
  begin
   here := this;
   repeat here := compass (thou, tab, what, next (here))
    until here = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Outline.

{ function outline (what: mode;
                    this: idea): idea;
  var thou: text; }

begin { outline }
 outline := compt (thou, circuit (thou, 0, what, clepe (thou, this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Excerpt.

function excerpt (this: idea): idea;
var here: idea;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Caption.

function caption (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if aspect (this) <> nil then
  begin
   there := next (this);
   if crest (there) <> nil then here := graft (twin (this), mend (there))
    else
     begin
      here := excerpt (there);  there := next (there);
      if edge (here) <> nil then here := graft (stitch, mend (there))
       else here := graft (twin (this), graft (here, mend (there)))
     end
  end;
 caption := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Extract.

function extract (this: idea): idea;
var here, there: idea;
begin
 here := nil;
 if rest (this) <> nil then
  begin
   there := this;
   repeat there := next (there);
    here := graft (here, caption (there))
   until there = this
  end;
 extract := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Excerpt.

{ function excerpt (this: idea): idea;
  var here: idea; }

begin { excerpt }
 here := nil;
 if lief (this) <> nil then
  here := image (extract (sequel (this)));
 excerpt := here
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Profile.

function profile (this: idea): idea;
var thou: text;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Contour.

function contour (var thou: text;
                      span: numb;
                      this: idea): idea;
var here: idea;
     tab: numb;
begin
 contour := this;
 if this <> nil then
  begin
   here := this;  tab := span;
   repeat here := next (here);
    if respect (here) <> nil then
     here := return (thou, recall (thou, skip (thou, anew (tab), here)))
    else if cope (here) <> nil then tab := span
    else if lief (here) <> nil then
     if edge (here) = nil then if suspect (here) = nil then
      here := obvert (here, contour (thou, tab, sequel (here)))
   until here = this
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Profile.

{ function profile (this: idea): idea;
  var thou: text; }

begin { profile }
 profile := compt (thou, contour (thou, 0, clepe (thou, this)))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Pause.

function pause (this: idea): idea;
begin
 pause := turn (hold (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Reserve.

function reserve (this: idea): idea;
begin
 reserve := pause (save (this))
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Interp.

function interp (what: mode;
                 this: idea): idea;
var here: idea;
begin
 interp := this;
 if this = nil then
  if what = null then here := space (con, this)
   else here := pass (con, 'nil ', this)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Dissert.

function dissert (what: mode;
                  this: idea): idea;
var here: idea;
begin
 dissert := turn (this);
 if this = nil then here := interp (what, this)
  else if what = moot then here := tell (this)
   else here := show (this);
 here := turn (here)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Explain.

function explain (what: mode;
                  this: idea): idea;
var here: idea;
begin
 explain := turn (this);
 if this = nil then here := interp (what, this)
  else here := show (turn (hold (dump (this))));
 here := turn (here)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Display.

function display (this: idea): idea;
var here: idea;
begin
 display := turn (this);
 if prompt ('input') <> nil then here := dissert (firm, this);
 if prompt ('face ') <> nil then here := dissert (moot, face (this));
 here := hold (here)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Expound.

function expound (that, this: idea): idea;
var i,
    now, who,
    lex, log,
    dup, fak, fac: idea;
begin
 expound := this;
 if this <> nil then
  begin
   i := turn (nil);  now := nil;  who := nil;  lex := that;  log := this;
   if prompt ('log ') <> nil then log := explain (firm, log);
   if prompt ('dupe') <> nil then dup := explain (firm, dupe (lex, log));
   if prompt ('fake') <> nil then fak := explain (firm, fake (log));
   if prompt ('face') <> nil then fac := dissert (moot, face (dup));
   i := ante (fac);
   if prompt ('sense') <> nil then now := dissert (firm, purport (log));
   if prompt ('stone') <> nil then who := dissert (firm, stone (i, now));
   if prompt ('stick') <> nil then who := dissert (firm, stick (i, now));
   i := pause (i)
  end;
 i := clear (i)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Study.

{ function study (this: idea): idea;
  var here, i, now, lex, log: idea; }

begin { study }
 study := this;
 here := turn (nil);
 i := nil;  now := nil;
 lex := fetch (nil);  log := scene (lex);
 if lex <> nil then
  begin
   if permit ('write num file', clear (nil)) <> nil then
    i := reserve (log);
   if permit ('show ram files', clear (nil)) <> nil then
    i := expound (lex, log);
   while permit ('query', clear (nil)) <> nil do
    begin
     here := graft (fake (till (log)), query (turn (lex)));
     if permit ('show files', turn (nil)) <> nil then i := display (here);
     if permit ('model', clear (nil)) <> nil then
      begin
       now := turn (model (till (here)));
       if prompt ('write mod file') <> nil then i := outline (null, now);
       if prompt ('write nom file') <> nil then i := reserve (now);
       if permit ('tenor', clear (nil)) <> nil then
        begin
         i := turn (excerpt (till (now)));
         if prompt ('write ten file') <> nil then i := outline (moot, i);
         if prompt ('write net file') <> nil then i := reserve (i);
         if permit ('canon', clear (nil)) <> nil then
          begin
           i := turn (till (i));
           if prompt ('write can file') <> nil then i := outline (firm, i);
           if prompt ('write nac file') <> nil then i := reserve (i)
          end;
         if permit ('recycle memory', lash (memcheck (clear (nil)))) <> nil
         then i := hold (at (2, 48, memcheck (recycle (till (i)))))
        end;
       if permit ('sense', clear (nil)) <> nil then
        begin
         i := turn (purpose (till (now)));
         if prompt ('write sen file') <> nil then i := profile (i);
         if prompt ('write nes file') <> nil then i := reserve (i)
        end
      end
    end
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Slate.

function slate (this: idea): idea;
var here: idea;
begin
 slate := this;
 while permit ('index', clear (nil)) <> nil do here := index (nil)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Chalk.

function chalk (this: idea): idea;
var here: idea;
begin
 chalk := this;
 while permit ('study', clear (nil)) <> nil do here := study (nil)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Order.

Order is a transformation of ideas that acts as the
identity transformation on the input idea and has
the following side-effects:  ...

{ function order (this: idea): idea;
  var here, flag, menu, venu: idea; }

begin { order }
 order := this;
 here := nil;  flag := nil;  menu := nil;  venu := nil;
 here := just (turn (brush (1, 54, buff ('< load menu files first >'))));
 venu := stage (here);  menu := fore (venu);
 if venu <> nil then
  begin
   flag := clear (match (menu, buff ('index')));
   here := just (chalk (clean (slate (here))))
  end
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Flint.

Flint is a transformation of ideas that acts as the
identity transformation on the input idea and has
the side-effect of repeating the single function
call, "here := order (nil)", as many times as
the user permits.

{ function flint (this: idea): idea;
  var here: idea; }
 
begin { flint }
 flint := this;
 while permit ('order', clear (nil)) <> nil do here := order (nil)
end;

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

Theme.

This is the main program.  Aside from declaring
constants, types, variables, and dealing with a
few other environmental properties, all that it
really does is execute the single function call,
"here := flint (nil)".

{ program theme; }

begin { theme }
 freemin := 4096;     size := 25;        trim := 40;
 assigncrt (con);     reset (con);       rewrite (con);
 checkbreak := true;  checkeof := true;  video (firm);
 here := clean (flint (nil));            close (con)
end.

Work Area 3

Let us first take up the basic building blocks of the Theme program.
These are divided into constructors, modifiers, and selectors.

Motivation Note 1


The lonely labor of documenting my old prototype program
is so mind-numbingly tedious at times that I will need to
start up this parallel thread of motivation notes just to
remind myself, and maybe to help clue other folks in, why
I am doing this, and why it still seems worthwhile to me.
I won't try to organize this too much ahead of time, but
let it be whatever mix of prospective and retrospective
thoughts come to mind in the process of carrying out
the documentary work.

The main idea behind the Theme One program is the
efficient use of graph theoretic data structures
for the tasks of "learning" and "doing logic".

I am thinking of "learning" in the sense of "learning about an environment",
in other words that will continue to fall short of a definition, acquiring
information about the nature of an environment and hopefully being able to
apply that information to some purpose.  Under the heading of "doing logic"
I am merely lumping together all the ordinary sorts of practical activities
that would probably occur to most people under that name.

There is a natural relation between these tasks, as learning the character
of an environment typically leads to the recognition of laws that govern
that environment, and this leads to requirement of being able to reason
logically about these laws in abstract terms.

Motivation Note 2


One of the most curious things that I learned --
or think that I got some kind of insight into --
during the decade-long process of writing the
Theme One program, is some of the reasons why
empiricists and rationalists seem to have so
much trouble understanding each other, even
when those two styles of thinking inhabit
the very same soul.

The way that this came about was like this.
The stock of code from which the program is
currently assembled initially came from two
different programs, that I worked on roughly
during alternate years, at first only during
the summers, at least, so far as active work,
and not just dreaming or musing or ruminating.

One of these programs was called "Learner", and in it
I deliberately sought to implement a Humean empiricist
style of learning algorithm for the adaptive uptake of
coded sequences of occurrences in the environment, say,
as might be codified in a formal language.  I knew all
the theorems from formal language theory that tell how
limited any such strategy must ultimately be in terms
of its generative capacity, but I wanted to explore
those limits in practical computational terms.

The other program was called "Modeler", and in it
I was seeking to implement a differential extension
of Peirce's graphical syntax for propositional logic
that I had developed in work over the previous decade.

As I mentioned, work on these two projects proceeded in a parallel series
of fits and starts through interwoven summers for several years, and then,
somewhere along the line, I can't remember just when, I realized that the
Learner, one of whose other names happened to be "Index", could be put to
work helping with sundry substitution tasks that needed to be done by the
Modeler, one of whose other names happened to be "Slate", since it evoked
innate ideas of the tabula rasa.

So I began to integrate the Learner and the Modeler,
at first still working on the two component modules
in an alternating intermittent manner, but devoting
a portion of effort toward the task of amalgamating
their principal data structures, bringing them into
convergence with each other, and unifying them over
a common basis.

After another round of seasons and many more changes
of mind and mood and programming style, I arrived at
basically the same graph-theoretical data structure,
strung like a wire through all the far-flung pearls
of my programmed wit.  And yet, as I discovered to
my consternation, the pearls that were polished in
counterposed years had still been glossed to shine
along axes of polarization that were skew in their
grains with regard to each other.  That is to say,
all of the strategies that would seem to be the
smartest tricks to pull from the standpoint of
optimizing the overall program's performance
on the Learning task I would discover to my
considerable dismay the next year were the
dumbest things to pull from the standpoint
of its performance on the Reasoning task.
I eventually came to appreciate this as
a "discovery", but then, what choice
did I have?

Document History


o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

TOP.  Theme One Program -- Source Code

00.  http://stderr.org/pipermail/inquiry/2003-March/thread.html#117
01.  http://stderr.org/pipermail/inquiry/2003-March/000117.html
02.  http://stderr.org/pipermail/inquiry/2003-March/000118.html
03.  http://stderr.org/pipermail/inquiry/2003-March/000119.html
04.  http://stderr.org/pipermail/inquiry/2003-March/000120.html
05.  http://stderr.org/pipermail/inquiry/2003-March/000121.html

TOP.  Theme One Program -- Motivation

00.  http://stderr.org/pipermail/inquiry/2003-March/thread.html#143
01.  http://stderr.org/pipermail/inquiry/2003-March/000143.html
02.  http://stderr.org/pipermail/inquiry/2003-March/000183.html
03.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

TOP.  Theme One Program -- Commentary -- 2003

00.  http://stderr.org/pipermail/inquiry/2003-March/thread.html#122
01.  http://stderr.org/pipermail/inquiry/2003-March/000122.html
02.  http://stderr.org/pipermail/inquiry/2003-March/000123.html
03.  http://stderr.org/pipermail/inquiry/2003-March/000124.html
04.  http://stderr.org/pipermail/inquiry/2003-March/000125.html
05.  http://stderr.org/pipermail/inquiry/2003-March/000144.html
06.  http://stderr.org/pipermail/inquiry/2003-March/000145.html
07.  http://stderr.org/pipermail/inquiry/2003-March/000146.html
08.  http://stderr.org/pipermail/inquiry/2003-March/000147.html
09.  http://stderr.org/pipermail/inquiry/2003-March/000148.html
10.  http://stderr.org/pipermail/inquiry/2003-March/000149.html
11.  http://stderr.org/pipermail/inquiry/2003-March/000150.html
12.  http://stderr.org/pipermail/inquiry/2003-March/000151.html
13.  http://stderr.org/pipermail/inquiry/2003-March/000152.html
14.  http://stderr.org/pipermail/inquiry/2003-March/000153.html
15.  http://stderr.org/pipermail/inquiry/2003-March/000154.html
16.  http://stderr.org/pipermail/inquiry/2003-March/000155.html
17.  http://stderr.org/pipermail/inquiry/2003-March/000156.html
18.  http://stderr.org/pipermail/inquiry/2003-March/000157.html
19.  http://stderr.org/pipermail/inquiry/2003-March/000158.html
20.  http://stderr.org/pipermail/inquiry/2003-March/000159.html
21.  http://stderr.org/pipermail/inquiry/2003-March/000160.html -- Fore
22.  http://stderr.org/pipermail/inquiry/2003-March/000162.html -- Graft
23.  http://stderr.org/pipermail/inquiry/2003-March/000163.html -- Pinch
24.  http://stderr.org/pipermail/inquiry/2003-March/000164.html -- Switch
25.  http://stderr.org/pipermail/inquiry/2003-March/000165.html -- Stitch
26.  http://stderr.org/pipermail/inquiry/2003-March/000166.html -- Splice
27.  http://stderr.org/pipermail/inquiry/2003-March/000167.html -- List
28.  http://stderr.org/pipermail/inquiry/2003-March/000168.html -- Roll
29.  http://stderr.org/pipermail/inquiry/2003-March/000169.html -- Image
30.  http://stderr.org/pipermail/inquiry/2003-March/000170.html -- Token
31.  http://stderr.org/pipermail/inquiry/2003-March/000171.html -- Tally
32.  http://stderr.org/pipermail/inquiry/2003-March/000172.html -- Gist

TOP.  Theme One Program -- Exposition -- 2003

00.  http://stderr.org/pipermail/inquiry/2003-March/thread.html#102
01.  http://stderr.org/pipermail/inquiry/2003-March/000102.html
02.  http://stderr.org/pipermail/inquiry/2003-March/000103.html
03.  http://stderr.org/pipermail/inquiry/2003-March/000104.html
04.  http://stderr.org/pipermail/inquiry/2003-March/000105.html
05.  http://stderr.org/pipermail/inquiry/2003-March/000106.html
06.  http://stderr.org/pipermail/inquiry/2003-March/000107.html
07.  http://stderr.org/pipermail/inquiry/2003-March/000108.html
08.  http://stderr.org/pipermail/inquiry/2003-March/000109.html
09.  http://stderr.org/pipermail/inquiry/2003-March/000110.html
10.  http://stderr.org/pipermail/inquiry/2003-March/000111.html
11.  http://stderr.org/pipermail/inquiry/2003-March/000112.html
12.  http://stderr.org/pipermail/inquiry/2003-March/000113.html
13.  http://stderr.org/pipermail/inquiry/2003-March/000114.html
14.  http://stderr.org/pipermail/inquiry/2003-March/000115.html
15.  http://stderr.org/pipermail/inquiry/2003-March/000116.html

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o

TOP.  Theme One Program -- Commentary -- 2005

00.  http://stderr.org/pipermail/inquiry/2005-January/thread.html#2268
00.  http://stderr.org/pipermail/inquiry/2005-February/thread.html#2334

01.  http://stderr.org/pipermail/inquiry/2005-January/002268.html
02.  http://stderr.org/pipermail/inquiry/2005-January/002269.html
03.  http://stderr.org/pipermail/inquiry/2005-January/002270.html
04.  http://stderr.org/pipermail/inquiry/2005-January/002271.html
05.  http://stderr.org/pipermail/inquiry/2005-January/002272.html
06.  http://stderr.org/pipermail/inquiry/2005-January/002273.html
07.  http://stderr.org/pipermail/inquiry/2005-January/002274.html
08.  http://stderr.org/pipermail/inquiry/2005-January/002275.html
09.  http://stderr.org/pipermail/inquiry/2005-January/002276.html
10.  http://stderr.org/pipermail/inquiry/2005-January/002277.html
11.  http://stderr.org/pipermail/inquiry/2005-January/002278.html
12.  http://stderr.org/pipermail/inquiry/2005-January/002279.html
13.  http://stderr.org/pipermail/inquiry/2005-January/002281.html
14.  http://stderr.org/pipermail/inquiry/2005-January/002282.html
15.  http://stderr.org/pipermail/inquiry/2005-January/002283.html
16.  http://stderr.org/pipermail/inquiry/2005-January/002284.html
17.  http://stderr.org/pipermail/inquiry/2005-January/002285.html
18.  http://stderr.org/pipermail/inquiry/2005-January/002286.html
19.  http://stderr.org/pipermail/inquiry/2005-January/002287.html
20.  http://stderr.org/pipermail/inquiry/2005-January/002312.html
21.  http://stderr.org/pipermail/inquiry/2005-January/002289.html -- Fore
22.  http://stderr.org/pipermail/inquiry/2005-January/002290.html -- Graft
23.  http://stderr.org/pipermail/inquiry/2005-January/002291.html -- Pinch
24.  http://stderr.org/pipermail/inquiry/2005-January/002292.html -- Switch
25.  http://stderr.org/pipermail/inquiry/2005-January/002293.html -- Stitch
26.  http://stderr.org/pipermail/inquiry/2005-January/002294.html -- Splice
27.  http://stderr.org/pipermail/inquiry/2005-January/002295.html -- List
28.  http://stderr.org/pipermail/inquiry/2005-January/002296.html -- Roll
29.  http://stderr.org/pipermail/inquiry/2005-January/002297.html -- Image
30.  http://stderr.org/pipermail/inquiry/2005-January/002298.html -- Token
31.  http://stderr.org/pipermail/inquiry/2005-January/002299.html -- Tally
32.  http://stderr.org/pipermail/inquiry/2005-January/002300.html -- Gist
33.  http://stderr.org/pipermail/inquiry/2005-January/002304.html -- Gage
34.  http://stderr.org/pipermail/inquiry/2005-January/002305.html -- Find
35.  http://stderr.org/pipermail/inquiry/2005-January/002306.html -- Suit
36.  http://stderr.org/pipermail/inquiry/2005-January/002307.html -- Coup
37.  http://stderr.org/pipermail/inquiry/2005-January/002308.html -- Stem
38.  http://stderr.org/pipermail/inquiry/2005-January/002309.html -- Sequel
39.  http://stderr.org/pipermail/inquiry/2005-January/002310.html -- Coupon
40.  http://stderr.org/pipermail/inquiry/2005-January/002313.html -- Gate
41.  http://stderr.org/pipermail/inquiry/2005-January/002314.html -- Knap
42.  http://stderr.org/pipermail/inquiry/2005-January/002315.html -- Knot
43.  http://stderr.org/pipermail/inquiry/2005-January/002316.html -- Respect
44.  http://stderr.org/pipermail/inquiry/2005-January/002317.html -- Suspect
45.  http://stderr.org/pipermail/inquiry/2005-January/002318.html -- Aspect
46.  http://stderr.org/pipermail/inquiry/2005-January/002319.html -- Apse
47.  http://stderr.org/pipermail/inquiry/2005-January/002324.html -- Sape
48.  http://stderr.org/pipermail/inquiry/2005-January/002325.html -- Pase
49.  http://stderr.org/pipermail/inquiry/2005-January/002326.html -- Apes
50.  http://stderr.org/pipermail/inquiry/2005-February/002334.html -- Apes
51.  http://stderr.org/pipermail/inquiry/2005-February/002335.html -- Like
52.  http://stderr.org/pipermail/inquiry/2005-February/002336.html -- Axil
53.  http://stderr.org/pipermail/inquiry/2005-February/002337.html -- Grasp
54.  http://stderr.org/pipermail/inquiry/2005-February/002338.html -- Fret
55.  http://stderr.org/pipermail/inquiry/2005-February/002339.html -- Deal
56.  http://stderr.org/pipermail/inquiry/2005-February/002340.html -- Lode
57.  http://stderr.org/pipermail/inquiry/2005-February/002341.html -- Lade
58.  http://stderr.org/pipermail/inquiry/2005-February/002342.html -- Lead
59.

o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o