Exploring Logo primitivesTo
practice LOGO conversation - and remember, only practice makes perfect - you naturally
need some minimal vocabulary. In your reading, you have already met some
useful primitives, print, first, last and word. The following (black-box style)
experiments should help you to become familiar with these (and others).
You will find that each primitive procedure does an extremely simple job. It is
by making them interact that
(before too long) you will get more interesting jobs done.
1. Procedures with one inputType
in the expressions below - one at a time, each followed by <return>
or <enter> (whichever your version of LOGO requires). On the basis
of LOGO's responses try to work out the function of the primitive bf
(the first word). Experiment with some different inputs (the words
or lists following the procedure
name) to make sure that you know what bf means, then repeat the process, replacing
bf, with bl
[cats dogs mice]
bf [[cats dogs]
bf [cats dogs] [lions tigers]
2. Using print (and some variants)You
will have discovered that LOGO's responses so far have all begun with
YOU DO NOT SAY WHAT TO DO WITH
X or (in Terrapin Logo for the Mac) RESULT: X. How do things change when
you write print (or pr for short) in front of
each of the expressions in 1?
Exactly what happens when you substitute
fprint or print1 or fprint1
for print? (You will need to watch out for more than the words
displayed on the screen!)
3. Error messagesYOU
DO NOT SAY WHAT TO DO WITH
X is clearly a complaint, i.e. an error message. What evidence can you find
to prove that. Equivalently, if you are using Terrapin LOGO, what demonstrates
that RESULT: (despite its attempt to disguise the fact) is really an error message
If you are having difficulty, try offering LOGO the following
(one line at a time):
pr "cat "dog
pr first "cat "dog
pr first "cat
See if you can figure out, on the basis of the
responses, how the interpreter processes these lines.
Is it possible to
use the occurrence (or non-occurrence) of YOU DON'T SAY WHAT TO DO WITH X (or
RESULT: X) to help distinguish between operations and commands?
with two inputsExperiment,
as you did with bf, with the following
two-input primitives. To
systematize your observations (now and later) you might find it helpful to use
a record sheet.
list "Tom "Harry
[Tom Smith] [Bill Jones]
list "Tom [Dick Harry]
[Dick Harry] "Tom
Try these again,
replacing list with fput, then lput
and then se
5. More complex expressions
Now try combining some of the primitives
of 1, 2 and 4 (and the ones you met in your reading) in more complex expressions.
What is the outcome, for example, when you instruct LOGO fprint
bl word "plan "er?
Try drawing procedure
diagrams to show what is going on.
hitting the right key?NB. If you are using Terrapin LOGO on
a Mac, remember to press the enter
key (not the return key) when you want to get the interpreter
to take notice of what you have typed.
Department of Linguistic Science
The University of Reading