Seymour Papert On Logo: Hurdles – Tape 4 – Digging Deeper (1986)

Hurdles – Digging Deeper

Automated Voice:         The following is a videotape module from the learning system, Seymour Papert On Logo. The tape series has two parts, the first “new mindstorms” focuses on the process and the principles of learning, the second Logo “hurdles”, focuses on specific technical aspects of Logo. This is hurdles tape number four, digging deeper. Like the other hurdles modules, it is intended for use with On Logo study guides and computer diskettes.

Speaker 2:                    In the next 10 minutes of tape, I’ll be leading you through the development of a Logo project, a rather more complex project than the ones that we’ve dealt with up to now. If you’d like to read about it, it’s the one called “meters” in the booklet. Regarded as a pure programming project, our goal will be to put something on the computer screen, something like this. Draw some numbers, and then set up an action. These pointers turning the dials that’s our project, but maybe it’s a good time to remind ourselves that our goal isn’t just production line programming to get this on the screen.

                                    I’d like you to stop the tape frequently and think, and as you think I’d like you to be mindful of two aspects. The first is association to the larger world away from computers, these are like counters, gas meters, numbers, units, tens, hundreds, thousands, and maybe you see that the technical problem of joining them together is going to be like what they call carry in the math class. Keep these associations. The second aspect that I want you to be mindful of is the relation of this project to a particular powerful idea, the idea of recursion will focus only on those aspects that are really relevant.

                                    We’ll forget about the numbers, we’ll think only of the way that this activity that we’re seeing here can be divided up into rounds. The whole activity divides up into four activities of the individual dials and could have been more than 4, 10, 100, 1,000 and the activity around each dial divides into smaller rounds, 0 to 1, 1 to 2, 2 to 3, 3 to 4. I’m going to call these little grams ticks, tick, tick, tick, tick, tick, tick, tick, or we might as well call that one a tock. One tock, 10 ticks.

                                    This analysis of actions and rounds, enables us to divide the problem into mind-sized bites. The smallest bite in this case, is the action tic, conceived as nothing more than moving the pointer. I’ve written a program in Logo, called To tic, which will do just that, and I’ve also written a Logo procedure to help visualize the way it works. I think it’s pretty self-explanatory, watch it. I’ll do it again. tic up there is a command, it doesn’t matter where it came from, it runs the procedure tic, tells the turtle back 72, the turtle will turn 36, and then go forward 72. As you noticed it’s in PX mode, when it runs over a line it erases it when it runs over nothing it draws.

                                    Let’s do this just one more time. The command tic runs the procedure to take back 72, right turn 36, forward 72, and wait there. That’s our first round, not much perhaps, but they say, “A journey of a thousand miles begins with one step.” And that’s part of the powerful trick we call recursion. The first round, simplified as it is, is a step on an infinitely mild journey to represent the open-ended action. Well, if we only had one dial, if we only had to worry about one tock, the job would be pretty well done. We could write a simple recursion, for example, To tock, tick, tock and that would do the trick, but since we have many dials, the problem is quite a little more subtle.

                                    I’d like us to think of it this way, anthropomorphize the turtle, think of the job the turtle is doing. Up to now, it’s had a simple job, it has to take care of its pointer, put it in the new position, now in addition, it has to pass on a message, it has to make a new action happen in the next dial, and you will see that in order to do this, as it moves its pointer around, it’s going to be asking itself at each stage on each tic, it’s going to be asking itself, “Is it now time to make the other one?” And most of the time the answer will be no.

                                    I’ve Illustrated this change by writing a modified version of the tic procedure, you see it starts just as before, right 36 and it’s turning, it’s going to go forward, it’s going to wait, then it’s going to do something completely different. If heading = 0, the turtle is being aware of which way it’s facing, and it needs to be aware of which way it’s facing because when it gets all the way around and it’s facing up, when heading is zero, it’s going to want somehow to produce a tic, not in its own dial but in the next dial, and that’s what this says. If heading = 0, take a look at that, this is a logo procedure we haven’t seen yet, “TELLNEXT TIC”. Its effect is meant to make a tic happen on the next dial, and that’s where recursion becomes hard.

                                    To help get a grasp of this otherwise abstract concept, I’m going to describe to you a special microworld, specially made for recursion. Some of you might actually know it, it’s a microworld of multiple turtles, and some versions of Logo in fact have them, but if yours doesn’t, doesn’t matter. We’re going to use multiple turtles here as objects to think with, rather than objects to program with; moreover, if you really do want to concretize it, on your diskette you’ll find the tools necessary to put a sufficient degree of multiple turtlicity into your standard uni-turtle versions of Logo.

                                    Let’s use multiple turtles in order to serve as a bridge across the next difficult hurdle in the development of this program. You see here two turtles, this turtle is drawing the first dial just as we have been looking at, and in fact it’s running exactly the same procedure. That second turtle is about to do a tic. This one will proceed, this one is inactive because the heading is not zero. You’ll notice that this turtle, the active one, is in a light color, this dark-blue one is inactive, the dark color tells you it’s inactive. As the active turtle comes around at a certain time, it will find that its heading is zero, it will cause the other turtle to become active now, it’s doing this the other turtle is active, the tic happens there, and the active state is passed back to this turtle. The process goes on.

                                    Well, I think with that, one can say that we’ve got the guts of what I call carry recursion by analogy with carrying in numbers. This doesn’t mean you don’t have a lot more work to do, I think to really appropriate it, even if you’re experts, you need to work at it. I’m going to give you two assignments, the first assignment is the obvious one, finish the programming job, get onto the screen something like as much as you can or more. Something like what we had at the beginning, but the important part of your job is to get a feel for what is going on here, to get that feel I think you have to do it in several different ways. Use the multiple turtle toolkit, do it with single turtle, maybe do it without any turtles at all using X and Y coordinates. The point of your job is to get the feeling that you understand and when you come back, I’ll assume that you’re saying, “TELLNEXT.” And then I’ll feel free to throw some new problems at you, that might make you wonder whether you really have understood what makes it tick.

                                    The screen shows our project. We’re going to write a procedure Switch, whose behavior is shown by these four lines. Print “THE PRINCIPAL IS MAD”, a logo instruction, and of course that’s what would appear, but print Switch, “THE PRINCIPAL IS MAD” will put this on the screen, “THE KING IS HAPPY”. The remains unchanged, principal turns into king, is to is, mad to heavy. Our problem is to write the procedure switch.

                                    How do we begin? How do we start designing something like Switch? I believe in a certain very powerful heuristic, always begin by looking for something that’s similar to the problem we want to solve, something more familiar but simpler, that captures part of what you have to achieve to solve your problem. In this case, I wrote a procedure called Switchword, that’s both simpler because it acts on words and not on list and it doesn’t use recursion, and more familiar because it’s closely based on examples we studied in the segment on inputs and outputs. Switchword takes a word as an input, and if the word is principal it outputs king, the word is mad it outputs happy, if the word is anything else it gives what it got.

                                    I’m going to use a visualization procedure to follow through how Switchword actually works. We know what the product of this instruction will be, print will ask Switchword for an input, Switchword has, “THE” as input since “THE” is now the principal no mad. Switchword gives what it gets, print will get “THE” and we’ll see the word “THE”. That’s the product. Now let’s look at the process. We use color coding to represent the stages in this process. I think you’ll pick up as we go, how we do this. Green shows the active procedures, “THE” shows an assigned input.

                                    Here’s the procedure Switchword, and the input on the title line says, “:THIS”, which has not yet been assigned but it will soon be, when it’s assigned it goes into blue. In the next stage, this will turn from gold to blue, if will turn green because it’s the active procedure here. This is what’s being done. Well, “THE” isn’t equal to principal and so if will now get false as its input, and it will simply go on to the next line. The same thing will happen here, “:THIS” became “THE”, it’s not equal to mad, if got false and now we come to the key line, which is output “THE”. The active procedure here’s output its input is “THE”, and we show how OP works by invoking our turtle, which will carry the information namely “THE”, to the place where it was requested up there.

                                    Print is now going to get its input, which is “THE” in blue, this is our original instruction, that is the product. Now let’s look at the same process with the word “PRINCIPAL” as input. Again, we see the procedure “:THIS” will turn blue “PRINCIPAL”, we will go down here if is about to become green because it’s the active procedure, “PRINCIPAL” is blue, “PRINCIPAL” = “PRINCIPAL” and so we’ll see true appear in blue, as input to if, and since “IF TRUE” causes this to operate, output here becomes the operative active procedure. Once more the turtle appears to show us what happens next. The information here “KING” is carried back to the place it was requested, print is going to find itself getting “KING” as input. There it is, and “KING” will be printed. There’s the final product of this instruction.

                                    We now turn to our principal procedure switch, print and switch are in green with input “THE PRINCIPAL”. I’ve kept it short to get on the screen, here is our procedure for switch. Its input is called “It”, about to be replaced by blue “THE PRINCIPAL” and we will go through the familiar process. “THE PRINCIPAL” is not an empty list, so we will see output symptoms come up in green and we’ll watch how sentence gets its first input. Here we go, this is the key part to focus on. First “THE PRINCIPAL” of course is the single word “THE”, Switchword “THE”. We’ve seen that operate, we don’t have to go through the process it will be “THE”. We now turn to the second input for sentence, and this time because it involves Switch, we’re going to need another copy of the procedure, another actor, but of course we first need its input, but first “THE PRINCIPAL”, take out “THE” and we’re left with “PRINCIPAL” as a single member of a list.

                                    Now we go to switch, “:IT” is about to be replaced by “PRINCIPAL” in blue, once more it will not be empty, so we will see a cycle there ending up with false as the input to “IF”, and we will go on to output sentence see how it gets its first input, again from Switchword first, of well what will it be? It will be “PRINCIPAL” of course. First “PRINCIPAL” is the word “PRINCIPAL” and Switchword with the input “PRINCIPAL”, gives us of course “KING” as we just saw. We turn to the second input for a sentence, sentence is waiting for its input here, “IT” in turn is going to need another copy of Switch, another actor here with an input empty, the empty list.

                                    Here we go, it will become empty, and this time it is empty. We’ll see “TRUE” as the input for here, and this is what’s going to happen. Output, the empty list, the turtle will be invoked, it will take this piece of information back to the previous green. Notice this one is waiting, like that one is waiting for this one and that one’s waiting for this one. The information is it’s the empty list, now sentence has its two inputs, it puts together the word “King” with the empty list, gets the list “King” and that goes off carried by the turtle back there to Switch. Switch “PRINCIPAL” is in fact going to be “King” we’ll see it appear. This sentence now has both its inputs, “THE” and “King” go together to give the sentence “THE KING”, output of that list will go back to the previous green which is our original instruction, and the turtle will tell it, the input to print is Switch “THE PRINCIPAL” namely “THE KING” and that’s what’s going to be printed.

                                    Print “THE KING”, and finally “THE KING” appears, there’s the product, we’ve seen the process. That brings me to the end of part two, as you go away to work on your own, I’d like you to remember that our purpose was building mental models, not so much getting computer programs to run as developing your own sense of how to think about them. I’d like you to practice using visualization programs, using acting out games, using any other devices to represent programs that you can think of, but think about what’s in your head, think about what you use to think about programming.