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

Global SchoolNet - Automated Message Archive

LOGO-L> READLIST




Michael Tempel (michaelt@media.mit.edu)
Thu, 14 Sep 95 10:26:16 -0400

Keith Gum wrote:

>I am a struggling beginner trying to hammer out a
>simple math tutor:
>
>To Quiz
>Make "num1 random 10
>Make "num2 random 10
>Make "answer :num1 + :num2
>pr :num1 pr :num2
>correct rl
>end
>
>To correct :response
>if equalp :response :Answer [pr [that's right!]]
[pr[wrong]]
>end

The problem is with RL (the full name is READLIST). It
reads what you type and reports it as a "list".
:NUM1, :NUM2, and :ANSWER are numbers, which are
"words" in Logo.

Let's say that :NUM1 comes up 3 and :NUM2 comes up 4.
Then :Answer is 7. You type 7, but in CORRECT, Logo
checks if 7 is equal to [7]. It's not.

If your version of Logo has READWORD, use it instead
of READLIST or RL. If not, you can write a READWORD
that will work in this case:

TO READWORD
OUTPUT FIRST READLIST
END

By the way, in most current versions of Logo EAQUALP
is EQUAL?. Or you can us = like this:

IF :RESPONSE = :ANSWER etc.
----------------------------------------------
Michael Tempel phone: 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.