[Inquiry] Re: Theme One Program -- Commentary Note -- Switch

Jon Awbrey jawbrey at oakland.edu
Wed Mar 19 13:54:03 CST 2003


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

TOP.  Commentary Note -- Switch

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

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;

(5326)(7666)

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




More information about the Inquiry mailing list