[Inquiry] Re: Theme One Program -- Commentary Note -- Graft
Jon Awbrey
jawbrey at oakland.edu
Wed Mar 19 13:22:34 CST 2003
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
TOP. Commentary Note -- Graft
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
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;
(5324)(7664)
o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
More information about the Inquiry
mailing list