by Ian Gronowski
Australian Apple Review V1 No 3 March 1987
In recent years Logo has become one of the most popular teaching languages. Designed at MIT by a team headed by Seymour Pappert, it has been successfully implemented on most micros, though the versions for the Apple have received the most acclaim.
The hardest thing about writing an article on Logo is to try to prevent it from turning into a review of “Mindstorms”. “Mindstorms” is a book by Seymour Pappert in which he sets forth his views on education. One paragraph particularly bears quoting:
“In many schools today, the phrase “Computer-Aided Instruction” means making the computer teach the child. One might say the computer is being used to program the child. In my vision the child programs the computer and, in so doing, both acquires a sense of mastery over a piece of the most modern and powerful technology and establishes an intimate contact with some of the deepest ideas from science, from mathematics, and from the art of intellectual model building.”
Logo provides the learning environment, the context with which the child learns how to reason. The idea of programming is introduced through the metaphor of teaching the computer a new word; and with this model the child develops naturally the idea of structured programming, of thinking procedurally. General problem solving methods- heuristic strategies – are encouraged by playing with Logo. Also rather than using the emotionally loaded terms of “right” and “wrong” and consequent shame about failing, using a computer results in the neutral concept of the “bug”. Errors become a necessary by-product of learning, not a child’s “mistake”. Most importantly, Logo is fun.
The Turtle The central theme of Logo is to provide easy entry into the world of programming for non-mathematical and hence pre-mathematical children. It amounts to a philosophy of education. Ease of entry is provided by the “Turtle”. A Turtle is an object with several characteristics, such as position and heading. It is like a person or an animal. Children can identify with the Turtle, especially as the Turtle is usually either an actual physical robot with wheels, a dome shape and a pen for drawing, or a “light turtle”, a triangular object on the screen. These two different physical objects are mathematically the same or “isomorphic”. The actual commands for controlling the Turtle are FORWARD and BACK, for movement, and RIGHT and LEFT to change the Turtle’s direction – to pivot it. Thus a square with side of length 100 units could be drawn by typing
FORWARD 100 RIGHT 90 FORWARD 1 00 RIGHT 90 FORWARD 100 RIGHT 90 FORWARD100
Procedures can be defined, i.e., we can teach the Turtle new words:
TO SQUARE: SIZE REPEAT 4 [FORWARD: SIZE RIGHT 90] E N D
This means “to draw a square, go forward the size of the side, then turn one right angle, and repeat this four times”. Now, just as we had previously typed in FORWARD 100 we can type SQUARE 100, to draw a square, as if it too was a “primitive procedure”. We have no way of telling that SQUARE, and not FORWARD was designed by the user. (Not strictly true). From simple beginnings we already have the powerful concept of modularity, of creating small conceptually distinct parts of programs that can be reused. When considering Logo, it is important to emphasise that it is designed as an educational tool – and not something to write databases with. This leads us to consider different issues than those considered when learning, say, FORTRAN. Turtle geometry is “intrinsic”. It only knows the local area, where it is at. This is opposed to the usual, global nature of school mathematics. Whereas in Cartesian geometry we define a circle as the locus of all points a given distance from a fixed point, the centre. It is represented by the equation:
(x-a)(x-a) + (y-b)(y-b) = r*r
With Turtle geometry a circle is defined in terms of constant curvature (curvature is how much we turn for each little bit we move):
TO CIRCLE REPEAT [FORWARD 1 RIGHT 1 ] E N D
Thus, to draw a circle take a little step forward and turn a little, and keep on doing it. This is more intuitive, and more powerful than Cartesian geometry. In terms of computer power it is also more useful. A Turtle Geometry definition is “imperative” it defines a circle, and it tells the computer how to draw it. A Cartesian Geometry definition is “declarative” it describes a property of a circle. In order to actually draw a circle from a Cartesian definition, you must translate that definition into a more useful form. The equation of a circle does not tell you how to draw it. The Turtle is an intuitive explanation of the heart of the ideas that lie at the foundation of the calculus, of differential geometry, and of modern physics. The Turtle is the analogue of the differential equation. With a Turtle we can easily simulate both Newtonian and Einsteinian physics.
We leave the Turtle for the moment to consider the other source from which Logo springs. This is LISP (LlSt Processing language), and the core of Logo. Its syntax and style are derived from the granddaddy of all Artificial Intelligence languages. In LISP the fundamental form is the list, an ordered sequence of arbitrary LISP objects, ie words or other lists. Thus, examples of lists include [3 2], [[5 7] ], and [FORWARD 100]. (In LISP, parentheses are used to delimit lists, in Logo brackets.) The distinction between procedures and data. tight and rigid in languages like Pascal, is blurred completely in LISP and Logo. Procedures themselves are stored as lists, as in the last example.
They can be manipulated like any other data: modified, passed as parameters to other procedures, and returned as results. So, we can easily write a procedure, say CREATE N-GON which creates a procedure which draws an n gon. Thus (CREATE N-GON 4) would result in a procedure 4-GON, which draws squares when called; (CREATE-N-GON 12) one which draws dodecagons, and (CREATE-NGON 200) one which draws (near) circles. The other feature drawn from LISP is recursion. The classic, if trivial example of a recursive algorithm is the definition of “factorial n”, written n !.
n!=n(n-1 )(n-2)* . . . 43211 l if n greater than 0; 1 if n=0
The recursive definition of n! is derived by noting that if n greater than 0, n!=n*(n-1)! and if n=0, n!1. In Logo this becomes
TO FACTORIAL :N IF :N = 0 OUTPUT 1 OUTPUT:N * FACTORIAL(:N-1) END
So far, the only Logo objects explicitly described are numbers, lists, and procedures. Two more fundamental objects are characters and words. Words are lists of characters, characters are standard ASCII. The list primitive operations such as FIRST, which returns the first element of a list, and BUTFIRST which returns the list consisting of all but the first element of its argument can be use on words and characters as well. Hence
FIRST BUTFIRST “LOGO
returns an 0. To quote Douglas Hofstadter, “Lisp is Crisp”. Unfortunately, I can’t come up with a nice rhyming three word summary of Logo. So. bearing in mind the richness and power Logo inherits from LISP, its brilliance as an educational language, a vehicle for the easy digestion of deep ideas in byte-size chunks, we might sum up with this (recursive) acronym for LOGO:
LOGO Offers Great Opportunities
“Mindstorms”, Seymour Pappert. This book is a must for all those interested in Logo, Computers and Education, or theories of learning. Well written, a joy to read.
“How to Solve It” George Polya. Another book which all aspiring computer programmers, mathemati cians and educators should read. A classic. “Goedel, Escher, Bach”, Douglas Hofstadter Monstrous clever linking of the music of Bach, the etchings of Escher, the metamathematics of Goedel. The book consists of text interspersed with dialogue, the dialogue between Achilles and the Tortoise illustrating the ideas with witticisms, nested puns, self referential jokes, and recursive acronyms. A beautiful book.
“Byte”, August 1982 August’s “Byte” is the language issue. In 1982 it was devoted to Logo.
“Turtle Geometry”, Abelson and diSessa. An essay mathematics text, using Turtle Geometry and Logo to teach vector calculus, relativity, and other fun Turtle stuff. High School level (an average HSC student should have no difficulty with it).