Executable Graphics: page 01

II. EXAMPLES OF EXECUTABLE GRAPHICS

In order to discuss the examples, some pre-analytical observations are needed about the terms 'graphics' and 'executable'. For the moment let us say that 'graphics' will include both text and graphics in a spatial arrangement (figure sam in the next section illustrates this taxonomy more formally). And 'execution' will be interpretation of a text-graphic form as instructions by the computer which, when performed, result in another text-graphic form being returned at the cursor.


VennLISP

The first example of executable graphics is the VennLISP notation system [Lakin80c]. VennLISP is simply a set of visual synonyms for the PAM dialect of LISP (see section III below) which processes visual patterns instead of lists of textual symbolic expressions. Function call nesting, denoted by all those parentheses in LISP, is indicated by concentric enclosure in VennLISP. VennLISP forms demonstrate how execution of a visual form can return another form as its value.

An explantion of VennLISP must start with the visual QUOTE function, . It is necessary for mentioning other visual objects directly. Executing a quoted object returns the object.

The VennLISP function         is used to select the first member of a visual pattern. FIRST         encloses its argument, which must evaluate to a pattern, and returns the first element of that pattern. All VennLISP functions (except and         ) evaluate their arguments before performing their                         operation.

The function REST is denoted by         . It returns a copy of the remainder of the elements in its visual         pattern argument.

The VennLISP form         performs an equality test, returning or ( is the empty         pattern, which in LISP fashion is also used for FALSE).

And now for some side effects so we can have naming.         is the VennLISP assignment form (actually designed in 1982 by Rob         Myers [Myers82]).         only evaluates its second argument, and performs the side-effect of         setting its first argument to its second argument. For the sake of purity it returns its evaluated second argument as its value.

And then when         is evaluated, it returns .

However, in 1979 when VennLISP was first implemented, a textual assignment statement was used. The SETQ form below was used in that system, as shown in figure vlisp.

To complete this brief introduction to VennLISP, we need a control structure. The VennLISP AND function, represented as         , evaluates each of its arguments starting with the topmost. If         any argument evaluates to then         is returned immediately as the value of the whole         form. Otherwise the AND form returns the value of its last argument.

More complex computing with VennLISP forms is shown in figure $vlisp. This illustration is a screen-image from the executable graphics programming environment at the Stanford AI Lab. First, through manual editing, the big AND form is positioned as the second argument of a LAMBDA (definition) form. Then the quoted LAMBDA form is inserted as the second argument of a SETQ form whose first argument,         , is the VennLISP nameshape for MEMBER? The LAMBDA form represents         one defintion of the membership test, returning or some tail of the second argument. And then, when the SETQ form is evaluated, the function to be invoked by the MEMBER? nameshape is defined. Definition occurs when the nameshape is bound to the LAMBDA form.

Next the other two SETQ forms are evaluated in order to bind to the mouth and to george. Finally we are ready to evaluate the call on         in the upper left corner. This function call determines whether whatever object         is bound to is a member of whatever pattern         is bound to. The result is         shown returned at the cursor in the upper right.