Just as in English, a LOGO instruction may sometimes contain nothing more than one command word. Stop! forms all by itself a complete instruction in English and stop is also a complete instruction in LOGO.(footnote) But, although stop is complete in itself, you will find that certain command words in LOGO require objects before they make sense, in the same way that English Drop! needs some indication of what to drop and Put! is not complete if you do not say both what to put and where to put it. Print, for example, is the name of a LOGO command, but to form an instruction using print, the command must be provided with (must be followed by) an object to operate on. Print "cat - with a space between print and "cat - is a complete instruction. It causes the word CAT to be printed on the screen at the current cursor position and then moves the cursor to the start of the next screen line. Make as the conversation transcript shows is more like English put. It needs to be followed by two things. In LOGO, paraphrasing loosely, you have to say make something (take the value) somevalue, or to paraphrase from a different viewpoint make something (be the name of) something. More specifically, in raw LOGO, the first example of the conversation transcript examples has the form: make "vehicle "car - which you could flesh out in English as Make vehicle take the value car.
Looked at from a natural language point of view a LOGO command word like print or make is a verb-like word and the LOGO objects we choose to construct with it, in order to make a grammatically correct instruction, are noun-like elements. Using more conventional LOGO-speak, however, we will talk of a verb-like word as the name of a procedure and the noun-like objects, to reflect their function, as inputs to the procedure.
In the instruction print "cat you will notice that the procedure name and its input are distinguished by more than just standard alphabetic characters. In particular, cat is preceded by a double quote mark. Such marks are important. LOGO treats any unquoted word as the name of a procedure and immediately tries to recall what it means. If you type print cat it will have no difficulty with print, but (unless you have previously taught it some procedure named cat) it will respond with I DON'T KNOW HOW TO CAT (exactly in the way it responded to smile, in the sample conversation) or, in Terrapin LOGO with, THERE IS NO PROCEDURE NAMED CAT. The double quote in print "cat is a signal to LOGO not to attempt any interpretation or evaluation of the word it precedes but simply to take it at face value, literally (as a sequence of letters). Opening square brackets at the start of a list perform exactly the same function. Except in some special circumstances, LOGO makes no attempt to treat words in lists as names of procedures.(footnote)
Now this characteristic of its output is not just a peculiar property of last. The typological identity of inputs and outputs is quite general in Logo. Operations always output precisely the sorts of data object which LOGO expects to find acting as inputs. In other words, operations always output (or return) either words or lists And this coincidence in type between inputs and outputs has important consequences. It is no accident. It has the effect that the output of any procedure is potentially an input to another, and it is in this possibility that lies much of the power of LOGO. A simple example will give an initial idea of the possibilities which are opened up. As we have seen, the expression last [cat dog] generates the output "dog. In so far as it is a word, "dog is an acceptable input to the primitive operation first which, as you will have guessed, returns the first element of its input. This being so, LOGO allows us - if we so wish - to write a more complex expression first last [cat dog] which interconnects the two procedures. This new expression can be expanded straightforwardly enough into English as the first element of the last element of the list [cat dog], which amounts, of course, to "d. Moreover, even if it is more complex than previous examples, the expression follows in essence the pattern we have already met. As we have seen, any direct inputs to a procedure, in the form of words or lists, are specified immediately after the procedure name. All we need in order to make sense of expressions involving indirect inputs is to accept an extension of this basic principle as follows:
Any procedure name may be followed either
1) in the direct case, by as many objects as required, or
2) in the indirect case, by as many procedures (together with their own inputs) as are required to return or pass on the appropriate objects.
It is on the basis of this mechanism for constructing complex expressions out of simple ones, that we can also build complex instructions such as print last "cat. With rather more daring you could try print first first last [beaune k6 [ [dijon 45] [ch‰lon.sur.sa™ne 30] [pouilly.en.auxois 46] [seurre 26] ] ] which LOGO will accept without complaint.
This requirement that an output must be dealt with explains why a grammatically acceptable LOGO instruction must begin with a command. A command outputs nothing - it therefore creates nothing which needs passing to another procedure.
The requirement also explains why most implementations of LOGO complain when anything like first "cat is typed in at the keyboard (at toplevel). LOGO complains because there is in this case no procedure to accept the output of first. The output is left in limbo. An error message like YOU DON'T SAY WHAT TO DO WITH C is, therefore, quite justified. (Terrapin LOGO unfortunately is at first sight more forgiving. Its response in the same circumstances is RESULT: C. But this too, despite appearances, is still an error message as you should be able to discover.)
Under these conventions, we could talk of expression diagrams being characterized by having an output box at the top(footnote).
(The partial circularity of this definition nicely draws attention to the possibility of an operation being provided with an input by another operation which itself is provided with an input by another operation . . . and so on, until at some point down the line direct inputs are specified.)
Given a definition of the term expression, instruction can be easily defined:
An instruction is a command followed by as many expressions as are needed to provide its inputs.
The function of an instruction is to get something done. Interaction with Logo is mediated by instructions.
[Note 2] As it happens, you will never actually use stop in conversational mode because LOGO will not stop to listen to you until it has finished carrying out your last instruction or, in the last resort, until it has been forcibly stopped by a drastic arm-bending technique which you will learn about quite soon. Saying stop in a conversation is therefore pointless. [Go back]
[Note 3] It might seem at this point that the quoting of words is an unnecessary complication. If LOGO knows what print means and what input it requires then it should have no more difficulty with print cat than we do with the English equivalent. You will soon discover, however, that inputs to procedures are not always provided as directly as this - see the next section - and in such circumstances the quotes are clearly needed. [Go back]
[Note 4] This explains why LOGO also complains You don't say what to do with dog - or in Terrapin LOGO's case says Result: dog - if you just type "dog at the keyboard.[Go back]