Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Query about STOP

19 views
Skip to first unread message

rot...@googlemail.com

unread,
Jun 3, 2009, 2:47:59 AM6/3/09
to
Hello

I'm working my way through Brian Harvey's 'Computer Science Logo
Style Vol 1' and have hit a snag at the end of Chapter 4 [1].

Here we are given the following procedures

to ask.thrice :question :answer
repeat 3 [if ask.once :question :answer [stop]]
print sentence [The answer is] :answer
end

to ask.once :question :answer
print :question
if equalp readlist :answer [print [Right!] output "true]
print [Sorry, that's wrong.]
output "false
end

I therefore change the quiz procedure to use ask.thrice:

to quiz
ask.thrice [Who is the best musician of all time?] [John Lennon]
ask.thrice [Who wrote "Compulsory Miseducation"?] [Paul Goodman]
ask.thrice [What color was George Washington's white horse?] [white]
ask.thrice [how much is 2+2?] [5]
end

My interaction looks like this:

?
quiz
Who is the best musician of all
time?
John
Lennon
Right!
?

My problem is that I don't understand why, when 'stop' is
evaluated in 'ask.thrice', 'quiz' stops as well. I was expecting
control to return to 'quiz' and for the next 'ask.thrice' command
to be evaluated.

I am running ucblogo 5.5.

I would be grateful for any guidance. Thanks.

[1] http://www.cs.berkeley.edu/~bh/v1ch4/predic.html

--
Rothril

Brian Harvey

unread,
Jun 5, 2009, 12:38:40 AM6/5/09
to
rot...@googlemail.com writes:
>? quiz
>Who is the best musician of all time?
>John Lennon
>Right!
>?
>
>My problem is that I don't understand why, when 'stop' is
>evaluated in 'ask.thrice', 'quiz' stops as well.

Right you are -- it's a bug in Berkeley Logo. I'm surprised nobody has
reported this before! Thanks; I'll work on it.

rot...@googlemail.com

unread,
Jun 9, 2009, 5:19:47 PM6/9/09
to
On Jun 5, 5:38 am, b...@cs.berkeley.edu (Brian Harvey) wrote:
> Thanks; I'll work on it.

Thank you! I thought I had missed something obvious. Also, thank you
very much for making a free-as-in-freedom Logo available as well as
your excellent books.

--
Rothril

Erich Neuwirth

unread,
Jun 16, 2009, 4:50:35 AM6/16/09
to
I think I have a partial explanation why nobody spotted it.
"repeat 3" does not imply "repeat.at.most 3" ;-)
from a language point f view.
I think that to most of the LOGO people
it would not occur to use stop inside repeat.
It is sensible, of course, to make the example work.

winstonsmith

unread,
Jun 16, 2009, 6:37:04 AM6/16/09
to
On Jun 16, 4:50 am, Erich Neuwirth <erich.neuwi...@univie.ac.at>
wrote:

> I think I have a partial explanation why nobody spotted it.
> "repeat 3" does not imply "repeat.at.most 3" ;-)
> from a language point f view.
> I think that to most of the LOGO people
> it would not occur to use stop inside repeat.
> It is sensible, of course, to make the example work.

Hmm... in TI Logo, STOP means to exit the current procedure, and
REPEAT is not in itself a procedure.

Brian Harvey

unread,
Jun 16, 2009, 9:53:28 AM6/16/09
to
winstonsmith <winston...@yahoo.com> writes:
>Hmm... in TI Logo, STOP means to exit the current procedure, and
>REPEAT is not in itself a procedure.

Maybe the TI manual says so, but this is not the Logo party line.

Everything Logo knows how to do is a procedure, including REPEAT. But
REPEAT is a /primitive/ procedure, and STOP stops the enclosing /defined/
procedure.

winstonsmith

unread,
Jun 17, 2009, 12:40:47 AM6/17/09
to
On Jun 16, 9:53 am, b...@cs.berkeley.edu (Brian Harvey) wrote:

Yes, but REPEAT is a procedure that takes a LIST of actions to RUN.
Consider the following REPEAT

REPEAT 4 [ PRINT "HELLO STOP PRINT "HI ]

output in TI Logo is:
HELLO
STOP MUST BE IN A PROCEDURE

This is what I expected. (similar action with RUN)

If I place this in a procedure:
TO T
REPEAT 4 [ PRINT "HELLO STOP PRINT "HI ]
PRINT "AGAIN
END

I get:
HELLO

(and that is it - because the STOP exits the procedure T.)

In any event, a "[ STOP ]" in either gives a:
TELL ME WHAT TO DO WITH [STOP]

Brian Harvey

unread,
Jun 17, 2009, 2:42:05 PM6/17/09
to
winstonsmith <winston...@yahoo.com> writes:
>In any event, a "[ STOP ]" in either gives a:
>TELL ME WHAT TO DO WITH [STOP]

That's a bug. You should still get STOP OUTSIDE PROCEDURE if that's the
case, otherwise nothing happens, just another Logo prompt.

At a guess, the bug concerns the proper handling of tail call elimination.
It would be interesting to know whether

REPEAT 3 [STOP PRINT "HI]

or

REPEAT 3 [PRINT "HI STOP]

have the same bug.

winstonsmith

unread,
Jun 18, 2009, 4:13:29 AM6/18/09
to
On Jun 17, 2:42 pm, b...@cs.berkeley.edu (Brian Harvey) wrote:

> winstonsmith <winston19842...@yahoo.com> writes:
> >In any event, a "[ STOP ]" in either gives a:
> >TELL ME WHAT TO DO WITH [STOP]
>
> That's a bug.  You should still get STOP OUTSIDE PROCEDURE if that's the
> case, otherwise nothing happens, just another Logo prompt.
>

I think it is more of a syntax error, as REPEAT 4 [ [ STOP ] ] is akin
to doing 4 of RUN [ [ STOP ] ] and RUN does not appear to like nested
lists (or a list more than one deep). So it doesn't appear to parse
the "[ STOP ]" whenever it is inside another pair of brackets.

> At a guess, the bug concerns the proper handling of tail call elimination.
> It would be interesting to know whether
>
> REPEAT 3 [STOP PRINT "HI]
>
> or
>
> REPEAT 3 [PRINT "HI STOP]
>
> have the same bug.

It would be interesting to see what other versions of Logo, from the
dawn of Logo to the present day do with a STOP inside of a REPEAT
inside a procedure.

If I do the above two repeats in a test procedure, I get nothing for
the first and "HI" for the 2nd. And a "STOP MUST BE IN A PROCEDURE"
for both when executed not in a procedure.

Brian Harvey

unread,
Jun 18, 2009, 3:01:27 PM6/18/09
to
winstonsmith <winston...@yahoo.com> writes:
>I think it is more of a syntax error, as REPEAT 4 [ [ STOP ] ] is akin

Oh! I didn't get it that you were using [[STOP]] as the second argument
rather than [STOP]. That's indeed an error; the second input has to be
an instruction list, not an expression; it's as if you'd said
REPEAT 4 [3]
instead of giving an instruction such as PRINT 3 or OUTPUT 3.

So I guess you're getting the right error message after all.

James Clayson

unread,
Jul 21, 2009, 8:35:32 AM7/21/09
to
We need you all at Constructionism 2010!!

The program organizers of the upcoming EuroLogo-sponsored conference,
Constructionism 2010, decided to concentrate this year on the philosophy of
learning, constructionism, that inspired Papert and Feurzieg to build Logo
in the first place and that has encouraged the construction of a wide
variety of other computational languages and tools.

We want to gather together all those teachers, students, researchers,
software designers, hobbyists who have enjoyed using Logo for a variety of
purposes and want to distill lessons from their experiences.

We want to also bring together those constructionists who are using other
languages or technologies - or no technologies. We want to take stock of the
constructionist agenda.

We want to broaden the scope of this conference to include people from art,
music, dance and the social sciences along with math and science folk.

Constructionism 2010 with include pleneries, small discussion groups,
workshops, concerts, exhibits, excursions, gala dinners - all in the
constructionist mode. All in Paris!

We invite you to look at the website and think about how you can contribute:
papers, posters, worshops, panel discussions.

It is time for us to retheorize constructionism and to state clearly some of
the lessons that we have learned..

http://www.aup.fr/news/special_events/constructionism2010.htm

We already have a long list of participants from all over the world. Many
with names that you will recognize and many who have worked more
independently and privately. Please join us!

sincerely,

James Clayson
Co-chair
Constructionism 2010

0 new messages