Seymour Papert On Logo: Hurdles – Tape 1 – Grammar (1986)

Hurdles – Grammar

Voiceover:                    The following is a video tape module from the learning system Seymore 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. 

                                    Author of Mindstorms, Children, Computers, and Powerful ideas and father of the Logo language Seymour Papert. 

Seymour Papert:           This little Webster says about hurdle, it can mean obstacle or it can mean artificial barrier, over which he says men and horses leap in a race. Both meanings are perfect. Logo has entry points everybody finds easy. Then, there are parts, which people who don’t have the appropriate background or support, experiences obstacles. What I’d like to do with these Hurdles tapes is make sure that you don’t experience them as obstacles but rather, indeed, as artificial barriers over which you can leap. I won’t promise effortlessly on the contrary, but with joy and intellectual grace. 

                                    A word or two about how to use the hurdles text. If you’re a total beginner to Logo, don’t. I assume that you know those easy parts. Roughly speaking what is covered in the New Mindstorms parts of the sequence. Then, I assume that you’ll take to my spiral way of presentation of the subject matter. Each segment has multiple levels of meaning. I assume that on first viewing of a segment you’ll get just enough to be able to dive off into the computer and then do some real learning. You’ll come back to viewing the tape segment. Maybe you’ll come back to it after seeing other tapes. Eventually you’ll find that you can see far beyond what at first you couldn’t fully grasp. In the end, I think you’ll come to see that my goal has been to be intuitively alive rather than dead accurate. I hope you enjoy [inaudible 00:02:49]. 

Voiceover:                    This is Hurdles tape number one. Logo Grammar. Like the other Hurdles modules it is intended for use with On Logo study guides and computer diskets. 

Seymour Papert:           Okay programmer, type your instruction. 

Speaker 3:                    Print, heading, return, logo.

Seymour Papert:           In this mental model hitting Return mobilizes an actor representing Logo personified. 

Print:                            I’m the Print actress.

Seymour Papert:           Logo mobilizes an actor for Print. Print would like a direct input for example, print something, but since she doesn’t find one directly she tries to get an input indirectly. Heading, she yells, hoping that a heading actor will wake her after a while and say, “Print here’s your input.”

Speaker 5:                    Which way are you facing? 

Turtle:                          I do a right 90. My heading is 90.

Speaker 5:                    Heading actor reported. 90.

Seymour Papert:           So she got her input. Now she can get on with her job. 

Print:                            90.

Seymour Papert:           I’ll be using these games to develop the idea of alternative mental models for thinking about Logo. I encourage beginners to use a linguistic model. This is based on the fact that instructions like “Print Heading” really could be English sentences. There is nothing wrong with the linguistic model it serves beginners very well. It is one of the factors that makes Logo so comfortable for children and other beginners. But, at a certain point you need something else. In the game you saw the elements of a transactional model, so called because it depends on transactions between active agents, here representing Logo procedures like Print and Heading. What this something else that gives you is, become apparent when you look at an aberrant Logo instruction like “Print Clear Screen.” 

Print:                            Maybe the clear screen actor can give me my input.

Seymour Papert:           Print hopefully yells, “CS.” 

Clear Screen:                I am the Clear Screen actor. 

Seymour Papert:           After all heading delivered an input, why shouldn’t this one? But CS doesn’t even know what she wants. All he knows to do is clear the screen and come back and say, “Wake up I’m done.” Here’s the first sign of trouble. Print was expecting something more. 

Print:                            I didn’t get an input. Error message print needs more input. 

Seymour Papert:           The model also helps us pin down the different roles of procedures in an instruction-like print heading. Print is a command in charge at the end of the instruction. Heading plays a subordinate role. It’s sent out by print to get an input, which is reported back to print. Being run for providing an input, is one of the ways in which a Logo procedure can be subordinate to another. A second way is illustrated by our next game. 

                                    Okay, House!

Mark/House:                Frame. Nothing’s happening. 

Frame:                          I’m here. Sorry, I’m late. Repeat four, right 90, forward 50. End. Is he awake? No. Get up. Get up. I made the square. 

Mark/House:                Square? 

Frame:                          Yeah, for the house. 

Mark/House:                What house?

Frame:                          You’re making a house.

Mark/House:                I am?

Frame:                          You’re calling up commands for a house, yes. 

Mark/House:                I didn’t know I was. 

Frame:                          Yeah, you were. But I don’t know what to say. Just do whatever the card says. See you later. 

Mark/House:                I dunno what’s going on. What that square doing there? [inaudible 00:07:12] Here goes anything. Roof! Nothing happened. 

Roof:                            [inaudible 00:07:25] Repeat 3, 450 Right, 120 End. Wake up. You’re falling asleep again. 

Mark/House:                What? First I’m seeing squares, now houses. Maybe I better see a doctor or something.

Seymour Papert:           Of course, Mark knows exactly what’s happening. He’s an expert Logo programmer. By feigning ignorance about the square, the triangle and the house on the screen, he is displaying a deeper expertise about something else. We’ve been watching Mark’s personal interpretation of an aspect of the transactional model. In this model, procedures work by using actors to run their various sub-procedures. It’s important for this model that these actors are as children say, “completely dumb.” So as actor for House, Mark only knows what’s written on his card. He knows that he is to run a procedure called “Frame.” Then one called, “Roof.” But what they do is not written there and as actor for House, he doesn’t know this. In fact, he doesn’t even know when they’ve done their job, unless they wake him and say, “I’m finished.” And when this happens, he can proceed to the next instruction and so on until he comes to End. 

                                    In these two games, we’ve seen two different ways in which Logo procedures can run other procedures as subordinates. In Print Heading, Print ran Heading as a reporter in order to get an input for it. In House, House ran Frame and Roof as sub-procedures. These are two very different situations. In the next game, we’ll see the two mixed in one rather complex transaction. 

                                    Compass is a remodeled Heading for use in a situation where you can be sure that the Turtle is always facing 90, 180, 270 or 0. Let’s see it work in a context where it’s called on by Print to provide an input.

Speaker 11:                  Print Compass.

Print:                            I’m Print. I need an Input. Compass.

Seymour Papert:           I heard Compass, I’m the Compass actor. I swing into action. My plan is to run through my procedure step by step, instruction by instruction, carrying out each one after the other. I begin with the first. I don’t have to look at its complexities. The command at the head is “IF.” I pass the buck. 

                                    “IF!”

IF:                                I’m IF. And I need two inputs. This is my instruction list. This one which should be either true or false, I don’t know about, so I’ll give it to Equals. Equals!

Equals:                         I’m Equals. I need two inputs. Here’s one. My first one is 90. But I need another. Heading? 180, my second input. 180 is not 90, so my output is false. 

IF:                                Well, my input is false now. I guess I won’t be able to run this. Compass, wake up. I’m finished. 

Seymour Papert:           If he’s finished my plan calls for me to continue instruction by instruction, through my procedure. Here’s the next one. It’s command is IF. IF!

IF:                                Well, I’m IF and I need two inputs. This is my instruction list and I need a true or false but I don’t know if this is it, so I’ll give it to Equals. Equals?

Equals:                         I’m Equals, I need two inputs. Here’s my first one. 180 but I need another. Heading? Ah, there it is 180. 180 equals 180. My output is true.

IF:                                Well, that means my input is true and I get to run my instruction list. I wonder what’s in it. I’ll give it to Output. Output?

Output:                        I’m Output, I need an Input and here it is. Okay, I’m in control now. Compass take this and give it to whoever is waiting.

Seymour Papert:           My plan was to carry out these instructions. Good thing I didn’t take the trouble to write them out because I’m never going to be able to do it. OP has the final say. I do what OP says. This is my output, I give it to Print. I’m finished. It’s as if I came to End. 

                                    You may be wondering know that you’ve seen all that what to do about it. What’s the assignment? Well, the easy assignment is go play some of these games yourselves. Slightly harder. Invent some puzzles like Print Clear Screen and resolve them. But what I really want you to do, is in your heads. I want you to change the way that you think about Logo. And even in the simplest situations, I want you to try to ‘transactionalize’ your representation of what’s happening. 

                                    When you write, “Print Heading” think of Print as saying, “Heading!” And think of Heading as coming back, “Here Print, here’s your input.”

                                    Everyone knows that Logo is an extensible language. A faucet of its extensibility is ‘modifiability.’ It comes with a collection of built-in procedures. You can use these as they’re delivered, or you an change them. This segment consists of a series of exercises in remodeling, in reworking the built-in procedures. The procedure term, is a remodeled version of Logo’s in-built procedure right. I first saw it used by a teacher who felt that Logo turns the Turtle too fast. This slows it down by making the Turtle do a lot of work. Right one is repeated as many times as you want to give it input to turn. 

                                    Hop is a remodeled version of Forward that responds to another feeling among teachers, that Logo requires beginning children to use input numbers that are too big. Five given to Hop, is like 50 given to Forward. These two procedures were remodeled in response to a teacher’s feeling that they would like Logo to fit more with the perception of numbers or speed of turning, appropriate to a child. In the segment though, I want to emphasis a different reason for remodeling, one that has to do with your own appropriation of Logo. 

                                    I want you to remodel in order to get a deeper understanding of how Logo works. 

                                    Think of acquiring a house, if you’re able to remodel it, it feels more yours, more appropriated. And besides feeling more yours, you understand it better. You understand its structure. You understand how it was built and why it came to be what it is. You certainly come to understand the structure of Logo better, by remodeling its built-in procedures. And so I propose this exercise: We’ll go through a bunch of build-in procedures. 

                                    These baskets represent categories into which little by little, we’ll sort the procedures I’ve written on these cards. I’m going to start with Forward. Won’t say much about it, we’ve dealt with it in constructing Hop and Right, we turned that into Turn. Show Turtle is a very interesting one. In my view, it represents the ultimate simplicity in Logo. It takes no input. It doesn’t have to be subordinate to something else. It’s an instruction all by itself. 

                                    Well, this remodeling of Show Turtle is so simple, you might wonder, “Why on earth do anything like that?” I’ll mention three reasons. One applies to you. I’m asking you to do things like this. The second applies to children. They often like to give names like “Vanish” and “Appear,” even if they’re long ones to personalize their procedures, using this in the place of Logos built-in procedure names like HT and ST. And, as for me, I’m doing this as a set-up for the use of the heuristic rule, which we’ll come to later, which consists of taking the ridiculously simple case that will actually be Vanish as the starting point for looking at more subtle ones. 

                                    Meantime, let’s go on. Show Turtle, High Turtle are dealt with. Print doesn’t need much comment, it’s rather like Forward, it has an input. It’s a command. Set heading is more interesting. It goes in a pair with heading. This is a command and this is a reporter. Set Heading changes the direction of the Turtle. Heading reports what that direction is. 

                                    We’re going to focus really on Heading. And I’ll show you on the screen, some aspects of our heading works that’ll be very relevant to our remodeling of it. 

                                    We make Heading strut its stuff, by putting it in an appropriate context. Print Heading, Print will look for an input. The reporter Heading, will provide the input to Print, which prints 0, corresponding to the way that Turtle’s facing. Let’s turn the Turtle, using our slow turn, watch it go. And, now if we ask for Heading, oh, we’re going to have to improve that, if a spelling mistake is too easy, we get 40. Why 40? Did it drop a 0? Think about it. It actually dropped a 360. 

                                    What happens if we do Heading without a command? As if a reporter could stand alone as a Logo instruction. As usual, we’ll try to understand the situation by acting it out. I’ll be Heading actor and in the wings I’ve recruited actors for the other roles. First let’s look at Print Heading. Here Logo

Speaker 15:                  Print!

Print:                            I’m Print. I need an input. Heading!

Seymour Papert:           I hear my name. I have to do my thing. Turtle, which way are you facing? Here it comes, I know what to do with this 40. Print asked me for it. Print, here’s your input. But where there’s no Print, only Heading-

Print:                            Heading!

Seymour Papert:           I hear my name I have to do my thing. Turtle, which way are you facing? There it comes, but no one told me what to do with it, it’s like I have a hot potato here. There’s no one I can give it to. 

                                    There are no hot potatoes in the computer. But if you type heading and hit Enter, you get something almost as dramatic, an error message. You might wonder why, why doesn’t Heading, print its own information and you might be planning to improve Logo, by remodeling it. Something like this: PR HDG is a new procedure which works this way. When you type it and hit Enter, 40, the heading of the Turtle appears. Of course, if you did say a little perversely: PR PR HDG. You would get 40, (by the way, reflect about why) and then the error message. 

                                    While it’s okay to remodel Heading in a way that builds the Print function into finding out which way the Turtle is facing. But I get a more powerful procedure by separating the reporting function of Heading from the Print function, which I leave to a specialist. A specialist that knows how to print and does just that. I’d like to write a procedure HDG, which will behave as near as possible like the original heading, and I’d like to be able to use it in this kind of context. And also, in this context. Remember this instruction from Compass, the procedure we studied in the first segment of this tape. We used it to find out if the Turtle was facing 180. Heading here, did something that had nothing to do with printing, although the procedure was going to do some printing later on like, Print South. But that’s another matter. I would like to use HDG, in this context. 

                                    Now, how do we go about writing a procedure like that? I’m going to use a powerful heuristic procedure, which consists of starting with something that has worked. I called this ridiculously simple, and I said we’ve used as a model, which I’m now doing by writing HDG exactly like this. Of course, they’ll be differences. The heuristic consists of starting with something that has worked and then, focusing on where we have to change it. HT is a command. It stands alone as a Logo instruction, as a line in a procedure. Heading is a reporter. It must report to something. Before even thinking about what it should report to, make a space, reflecting the fact that we’re trying to decide what to put in there. We’ve isolated the next mind sized bite of the problem. What Logo procedure do we put in, for Heading to report to?

                                    You attempted to use Print and we rejected that. It so happens that Logo has a built-in procedure, OP for output that does exactly the right job. OP will take whatever Heading reports and force HDG to report that to whoever is waiting, and if nobody is waiting, what Heading reports will be a hot potato. 

                                    The built-in procedure OP, abbreviation for output is a powerful one in two respects. It’s the only means Logo gives you to write your own reporters. Any procedure you write as a reporter must have an OP in it. There’s no way round it. It’s powerful also in that it exerts control over the way that procedures interact with one another. Let’s find its card and then focus on that. 

                                    We were at Heading, which of course goes in the Reporter Bin. Then we have SET BG and BG. Another twin like “Set Heading and Heading,” this can make the background color be what you want it to be. This tells you what the background color is, as if you couldn’t see. Then we have OP. Where we put OP? Report? Command? Well, it’s function is distinct enough to deserve a special bin, which I’ve labeled “Controllers.” The name Controller, is suggested by the role that OP played in the procedure Compass, we acted out in the first segment of this tape. 

Output:                        I’m Output. I need an Input, and here it is. Okay, I’m in control now. Compass take this and give it to whoever is waiting. 

Seymour Papert:           So OP really is powerful. And it’s an essential ingredient for remodeling reporters. But what about remodeling OP itself? That’s another question and I’ll hold it til we meet the next controller. Meantime, let’s go on sorting and talking about remodeling other built-in procedures. POS and SET POS give us another twin, a reporter that reports the position the Turtle happens to be in. SET POS, a command that puts the Turtle into any POS position that you want. First, of course the reporter, you give it a word and it will report the first letter of the word. Or, you give it a sentence and it will report the first word of the sentence. A reporter. Sentence is one of the most widely used list reporters. 

                                    Here, we see sentence (SE) in the context of a complete Logo instruction. “SHOW!” Show becomes the active agent. It needs an input. “Sentence!” Sentence flashes, showing that it has taken the initiative. Show is asleep. Sentence needs its inputs and turning blue shows that they’re assigned. In gold, up here, we see something that represents a sentence actor. It needs its input, it finds them down here, one at a time. It now does its job, which is to output one list made up by combing the two lists: (CAT DOG) and (LION) gives (CAT DOG LION). Outputs it to where? Well, Sentence was giving an output to Show, which called for it. And so this is replaced by a situation equivalent to the instructions, “SHOW (CAT DOG LION)” as if this is what we’d given to Logo in the first place. 

                                    Show becomes active, it looks for its input. There they are. We put that one back in white because we’re through with it. This is where the work is being done and what does the work consist of? This. (CAT DOG LION) is printed. Put that back in white to show we’ve done with it. 

                                    In Logo grammar, Sentence is a reporter because it has an output. But if you think not of its grammatical classification but of its function, you can think of it as a manufacturer, maker of lists. And, if it’s the most frequent manufacturer of lists in elementary Logo, the most frequent consumer of lists is Repeat. Here’s a complete instruction with Repeat. Notice it’s a consumer of number, which it needs for its first input and of lists, which it needs for its second input. This list has four words note. But they make up two Logo instructions, so we call it an instruction list. 

                                    By the way, while we’re looking at it, there’s an observation. I’ve noticed in classes that teachers sometimes say you have to use brackets with Repeat. Not true. Brackets are used to give a list as a direct input to a procedure, but if we look at this remodeling of Repeat as RPT, a shortened version, it has two inputs, which are called Number and Action. And the one line body of the procedure is Repeat dots Number dots Action. While Action has to be the name of a list, otherwise Repeat would give you an error message, there are no brackets to be seen anywhere. 

                                    Repeat is a command. Run is often used as if it was synonymous with Repeat One Time. As such, it would be a command and go here. But Run also has some features that allow it to be used a reporter, which would put it there. So, like IF, it doesn’t quite fit. This exceptional status of IF, is what is designated by the use of the word “chameleon,” that you might have noticed on this card. It’s consequences will be explored in later tapes. 

                                    I’m going to end on Stop. Perceived as a controller, let’s compare it with output in these two procedures. The actor for a procedure like Silly, has an initial plan to carry out each instruction one at a time, until getting to End. In the presence of OP, this normal flow of controllers, it’s course can be disrupted.  Right 90 and then OP asserts its power as a controller to say to Silly, “Drop everything, give 90 to whoever is waiting.” And, of course, Forward 1000, will never be done. By the way, if no one is waiting, 90 will become a hot potato. 

                                    Sillier follows exactly the same kind of pattern: Right 90, then Stop says, “Drop everything, say you’re done.” Forward 1000 will never be run. So it is a controller just like output. An the time has come for me to keep my promise to say something about remodeling controllers. Actually, you can’t do it. Let’s get some insight into where the difficulty lies by looking at an attempt to remodel Stop. 

                                    To give ourselves a context for thinking about why we can’t remodel Stop, I’ve set up this procedure which doesn’t stop. Forward 10 turns right and its recursive, it’ll keep going forever in a sort of not quite circle. If we put in a stop rule, there’s at least a hope that it will stop as the heading changes here ever gets to 0, it will stop. Give the the command, “Wander” and the Turtle will set off on a not quite circular path. And, if we’re lucky as we are, Heading got to be 0 on the first round and it stopped. Look back at the procedure and let’s consider this attempt to remodel Stop. To quit, stop, end. This actually is a legitimate Logo procedure. It will run but what will it do? Well, nothing. It will just stop itself. Now if we put it back there in the place of Stop and Wander, would it stop Wander? Well, no. Quit will only stop itself. It will do nothing else. 

                                    Thinking about that is quite an instructive process for understanding the structure of Logo programs. In designing the segment, I had another goal besides clarifying issues of Logo grammar. I wanted to counteract some tendencies in Logo programming that I see often when I visit schools. One of these is an avoidance of reporters. It’s as if people feel that OP, using outputs, is inaccessible or difficult or useless. 

                                    The other is an understandable pride is writing long procedures. It’s a good thing to write long and complex procedures. But there’s an avoidance of simple, short ones. In the segment we’ve seen how one liners can be immensely instructive, and in the next segment we’ll see how some one line reporters can produce some extremely surprising and interesting results. 

                                    In this segment, I introduce a new open ended Logo project. The project is designed to strengthen your grasp of the use of outputs and of list manipulation. It is intended to weaken the idea that language programming and graphics programming belong to two different chapters of Logo. I introduced the project by showing some little things I’ve done, in the direction in which it goes. I then encourage you to go off on your own. 

                                    I’m going to show you a Logo program, that makes the computer appear to understand English, at least some English. When we type, “DRAW A SQUARE” it does just that. And, if we type, “DRAW A RED TILTED SQUARE” well it’ll even understand that and do what we said. “DRAW A BLUE TRIANGLE,” it will draw a triangle. 

                                    With these props, I’ve reconstructed the situation you saw on the computer screen. “DRAW A RED SQUARE,” a Logo instruction disguised to look like an English sentence. It’s made up of four procedures. DRAW, A, RED, and SQUARE. I’d like to look at them one at a time to build up an understanding of the whole instruction. DRAW is a command. There’s no output. THat’s how it can be at the head of the instruction. It takes an input, it runs it. In other words, DRAW is simply a renamed Run, or if you like, its renamed, “Repeat one, its input.” Suppose we gave this as input. It would run it. Clearly it expects to get an instruction list, as its input. So, if we did that DRAW Repeat 4 Forward 50 Right 90, a square would appear. Not a red square but we’re getting there. Let’s look next at the role of Square. 

                                    Square is meant to be like this. It is a reporter. It has no input so it can run without depending on anything else. And it will output this thing [inaudible 00:35:08] instruction list and when DRAW gets that, of course, it draws the square just as before. Now let’s look at A, DRAW A SQUARE. A is a remarkably simple but fascinating procedure. It takes an input, it outputs it. In other words, it gives just what it got. “Gives what it got” is a good phrase to remember. It does nothing. But in doing nothing, it gives us in a very very pure form a model for the transaction between getting an input and giving an output. Of course, its functional role here is to make our sentence more like English, but in terms of the way Logo works, it’s a transmitting channel. It takes the output from there passes it on to DRAW. 

                                    So, let’s go back now to our beginning and fill in the remaining element in the puzzle. RED really isn’t … RED is a complicated procedure. It takes an input, of course, it’ll take instructions as given out by SQUARE. It’s going to output. It’s a reporter. What will it output? It uses Sentence to construct a list by putting together two lists. This one is “Set color dots red,” a list of two words. This one, well, it’s whatever it gets as input. Suppose it got our familiar input there. It would take these two lists, combine them together, using the reporter’s sentence. We’ll let’s just do it ourselves. Like that. Take away this little bracket here, we’ve got a list, “Set Color dots Red Repeat 4 Forward 50 Right 90). 

                                    In other words, we have an instruction list which will change the color of the pen to red. When we run this the pen color will become red, a square will be drawn, and so if we give this thing to draw as its input, you will see a red square on the screen just as in fact did happen.