[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> MicroWorlds: working with textboxes



At 17:53 23.10.1998 +0930, you wrote:
>Can anyone explain this behaviour of textboxes in MicroWorlds version 2:
> Put 5 textboxes on the page
>Type 3 in text1
>Type * in text2
>Type 4 in text3
>Type = in text4
>leave text5 blank
>
>1) In the command centre type:
>text5, pr text1 * text3
>15 will appear in text5
>
>2) In the command centre type:
>text5, pr text1 text2 text3
>error message: I don't know what to do with *
>
>3) Now try:
>text5, pr  run (list text1 text2 text3)
>I don't know what to do with 3
>
>4) Try:
>text5, pr  run (list text1 * text3)
>15 appears in text5
>
>Why don't  attempts 2 and 3 work??

Your attempt 2 should not work. According to Logo evaluation rules only the
result of text1 is sent to pr and then then you do not say what to do with
the result of text2. In the first example a different rule takes place - if
you write literally an * sign, then text1 * text3 is recognised as an infix
expression and is evalueted prior to calling pr.

But your attempt 3 should work.
It is apparently a MicroWorlds bug.
This session transcription shows that the problematic element is the * sign:

make "x (list 3 "* 5)
make "y [3 * 5]
make "z (list text1 * text3)
make "t (list text1 text2 text3)
show run :x
15
show run :y
15
show run :z
15
show run :t
I don't know what to do with 3
show :t
3 * 5
show identical? :x :t
true

while :x and :t are said to be identical, the result of runing them is very
different...

I have found two workarounds:

1. If you apply a FIRST operation to the content of text1, then the problem
disapears:
show run (list text1 first text2 text3)
15
strange, but useful to know. You can use it if you use just one character
operators.
By the way:
show identical? text2 first text2
true

2. run also accepts words, so you can create a word instead a list to form
the expression. In this case you have to put spaces (char 32) into the word
to separate the operands:
show run (word text1 char 32 text2 char 32 text3)
15

I hope this helps to you.

If someone from LCSI is listening, then he/she could try to correct this
bug for the next version :-)


Regards

Peter Tomcsanyi

My favourite Logo:
http://www.logo.com/catalogue/titles/superlogo/index.html
http://www.edi.fmph.uniba.sk/logo/

---------------------------------------------------------------
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.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home