Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 3 / MARCH 1983 / PAGE 187

Logo ideas. Robert Lawler.

Logo Ideas

Different Kinds of Variables

If a variable is defined outside of a Logo procedure, its value can be changed by keyed commands or by executing any procedure which refers to it. Such a variable is called a Global variable. Now, if you store something in a box, generally you would like it to remain there until you change the contents of the box. You can't count on the contents of a global variable unless you take special care to guard against unexpected references. One way is to give your variables unusual names, e.g. [MAKE "GRANDMOTHER'S.SHIN.BONE 3]. The reason not to use unique variables is the difficulty of remembering what name you assigned. A second technique is to "initialize' every variable in every procedure before you refer to it. Doing this becomes a little tedious when you write lots of procedures. A third method is to use local variables.

Local variables are defined only within the context of the procedure which references them, so no procedure or keyboard entry can alter the value of another procedure's local variables. Further, local variables exist only within a specific execution (or "instantiation') of a defined procedure. This convention of the Logo language (and others as well) is central to the use of input variables (and others) in recursion. Consider the procedure below:






When you key SQUARE 4, the Logo interpreter creates an instantiation or copy of the SQUARE procedure for execution. Let's refer to it as 1-SQUARE. The value of the corresponding variable 1-:SIDES-TO-GO is 4. When the third line of 1-SQUARE executes, the Logo interpreter creates a second copy of SQUARE; call it 2-SQUARE. What is the value of the corresponding variable 2-:SIDES-TO-GO? The answer is three. Executing 1-SQUARE, the Logo interpreter evaluates 1-:SIDES-TO-GO as 4 and subtracts one from it, then assigns 3 as the value for the variables 2-:SIDES-TO-GO. In successive recursions of SQUARE 4, this is what happens:

The theoretician Dijkstra, inventor of the language Algol and one of the pioneers in the development of programming, said that once you understood how variables are used in programming, you understand the essence of programming. We believe he was referring to local variables as used in recursion when he said that. Understanding local variables has become more important in the world of systems and commercial programming as well with the use of "re-entrant' code in operating systems. Many such systems have extensive subroutine libraries. When these subroutines use local variables and observe other coding restrictions, they are re-entrant, which means they can be used simultaneously by several programs.

Variables and Abstraction

The Logo turtle can't deal with abstractions. It must go forward some specific amount or turn through some specific number of degrees. When you key FD :some-distance, the Logo interpreter evaluates the symbolic name "some-distance' (looks in the box or storage cell to determine its contents and substitutes that contents for the expression :some-distance).

People apparently can deal with abstractions, but find problem solving easier when they don't have to do so. Most often when a new procedure is being written, people use specific operand values, e.g. FD 100, which they later change to variable form, such as FD :some-distance. The nature of the abstraction involved is common to some other examples of mathematics as well.

The famous mathematician Bourbaki describes the creation of an axiomatic system as proceeding from the mathematician's working out a series of theorems with very concrete examples in mind and subsequently examining the inferences of his theorems to define precisely which characteristics of his examples were used by the theorems. in a third step, he redefines the set of objects to which his axioms apply as that most general class of objects having all those characteristics used in the theorems. That is, he bases his generalization on the operations he performed and not on a list of the characteristics of the example he began with.

We stress that the process through which a child generalizes a procedure after creating a concrete product with a concrete precursor, this child's play, is particular kind of abstraction of value in the most intellectual endeavors as well.

This mathematical form of abstraction is called reflexive abstraction by Piaget, who sees the child creating his own mind through processes of thought that are like those of Bourbaki's mathematician. This points to the most significant potential impact of computer experience on children developing their minds. Reflexive abstraction may become more "natural' to them than what Piaget calls "Aristotelian abstraction' (abstraction by feature selection and classification) with which Piaget contrasts it. That is, children of the future may more often think like mathematicians than do children of today.