[Back to GSN Home Page] [Back to Message Index]

Global SchoolNet - Automated Message Archive

LOGO-L> MicroWorlds Logo Syntax




Michael Tempel (michaelt@media.mit.edu)
Mon, 8 Jan 96 16:12:53 -0500

In recent post Bill Kerr discusses what he feels is
inconsistent Logo syntax in MicroWorlds:
=============================================
Create a textbox and call it word.list. Put these words into
this text box, with a carriage return (Enter) after each
word:

see
bee
meet
feel

Then create another textbox and call it receiver. Make the
receiver textbox active by clicking in it. Next, in the
command centre type:

pr word.list

The four words in the word.list textbox will be printed in
the receiver textbox. In this instance the word.list textbox
is behaving as a reporter. No punctuation like : or " is
used in front of word.list. It reports the contents of the
textbox (four words) to the print command.

Now type this in the command centre (with the receiver
textbox active):

pr textpick "word.list

One of the words of the four in word.list will be printed in
receiver.

However, note that word.list is now NOT behaving like a
reporter because this time quotes or " have been used in
front of it. In other versions of Logo quotes or " are NEVER
used in front of reporters. This is because quotes or " have
a special meaning in Logo syntax, which means take the word
that follows the quotes literally.
===============================================

Let's take that last paragraph first. How about this:

print heading
45 (or whatever the turtle's heading happens to be)
print "heading
heading

Instead of asking what the quote marks do, ask what Logo
does when there is no punctuation: If Logo encounters a
word without punctuation it assumes that you are using the
word as the name of a procedure that it should try to run.
In the case of

print heading

there are two procedure calls. The first is print, a
command. So print goes into action. Print needs an input
(that's in its nature). It looks down the line and finds an
unpunctutated word. So heading springs into action.
Conveniently, heading is a reporter which reports some
number. Print is happy and puts the number on the screen.

The fact that heading is the name of a reporter doesn't mean
that you can't use the word for something else as in

print "heading
heading

Here's another example. Start MicroWorlds and create a
slider. It will be named slider1 unless you want to give it
some other name. (Also create a text box so as to have a
destination for print commands.) Now type

print slider1
50

slider1 has no punctuation so Logo assumes it's the name of
a procedure and runs it. Since slider1 is the name of a
reporter, running it gives print an input and everyone's
happy. As with heading you can type

print "slider1
slider1

Now there are some MicroWorlds Logo procedures that do
things with the various MicroWorlds objects. For example
remove is used to eliminate turtles, text boxes, sliders,
etc. Remove needs an input - the name of the object you're
zapping, as in

remove "slider1

If you say

remove slider1

you would be telling Logo to remove an object whose name is
50 (or whatever number the slider happens to be set to).
That's not what you mean.

In Bill's example, he created a text box named word.list and
typed some words in it. When you type

Print word.list

word.list reports the contents of the text box to print.

Textpick is one of those procedures (like remove) that does
something with MicroWorlds object. Textpick's job is to
report a randomly picked line from a text box. In order to
do its job it needs to know the name of the text box to work
with, as in

print textpick "word.list


If you said

print textpick word.list

You'd be telling textpick to look for a text box whose name
is

see
bee
meet
feel

That's not what you mean.

There's a very funny play in New York now, "Picasso at the
Lapin Agile", in which Albert Einstein says that the
problem with the theory that the earth is at the center of
the universe was that it was ugly. You had to have planets
moving backwards in their orbits and other strange and
inconsistent things going on. With a different perspective
things are consistent and much prettier.

--------------------------------------------------
Michael Tempel Tel: 212 765 4918
Logo Foundation FAX: 212 765 4789
250 West 57th Street
New York, NY 10107-2228
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.