Tinker: a programming by Demonstration System for Beginning Programmers by Henry Lieberman Media Laboratory Massachusetts Institute of Technology

Figure 4: Introducing the first example for Stack

Download 177.19 Kb.
Size177.19 Kb.
1   ...   4   5   6   7   8   9   10   11   ...   15
Figure 4: Introducing the first example for Stack

Constructing Lisp Expressions In Tinker

The user constructs Lisp expressions in Tinker by assembling functions and arguments, like pieces of a jigsaw puzzle, in the The Snapshot Window contains a list of items, each representing a single Lisp expression and its value. Each item contains two parts: a , and a . The result is always the value of the code in the current example situation. The #, notation is Tinker’s way of printing CLOS instances; in this way an instance displays its slot names and values when printed.

Instant Turtle and its kin are only suitable for imperative domains like graphics, where each command is performed for its side effect. In functional languages like Lisp and Logo, expressions return values, and a value returned by one expression can be used as an argument to another function. How does this concept fit into a programming by demonstration system?

In Tinker, when an item is selected as an argument to a function, the value of its result part is used, but the code part gets carried along as a component of the code part for the function call. The result part appears before the code part in each entry to emphasize that it is the value of the result that will be used when the entry is selected as an argument to another function. Thus, Tinker records the complete history of between Lisp values and the code that produced them.

The idea of a procedure as a remembered set of actions is generalized in Tinker from a simple linear list as in Instant Turtle and simple keyboard macros, to the tree structure necessary for building expressions in a functional language. The key idea is that the result, or value produced by a set of actions can be used as input to subsequent actions.

Beginners typically have difficulty programming complex expressions involving nested function calls. They find it hard to keep in their heads what the effect of each subexpression will be. Tinker relieves this problem by allowing a beginning programmer to build up a complicated expression incrementally, examining the result of each piece in a representative case before using it as part of some larger expression.

Share with your friends:
1   ...   4   5   6   7   8   9   10   11   ...   15

The database is protected by copyright ©essaydocs.org 2020
send message

    Main page