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

Re: LOGO-L> Inverting Numbers



Olga Tuzova wrote:
> 
> There is another thing there. It seems my experience of teaching
> Pascal began to play bad tricks with me. In Pascal program all the
> variables are to be described in the very beginning of the program.
> And then you can't summaries variables a and b if a defined as a char
> and b - as a number, or if they both defined as a char type. But, in
> Logo it proves to be not forbidden. The following lines works
> wonderfully:
> make "a "1
> make "b 2
> show :a+:b
> And you'll get 3!
> 

It's Logo doing "bad" tricks and Pascal that's doing things "good".
It's called Strict Type Checking and one of the reasons why Pascal
was done the way it was and why it was very popular.

The above code you listed should generate a bug because you usually do
not want to mix datatypes unless you explicity tell it you want to. It's
helping you to stay out of trouble. For example the code you wrote
above in many lauguages would give the ascii value of 1 plus 2 and the
answer would be "c :-). Which is correct 3 or "c. Pascal does not allow
you to be ambiguous, it's "Strict".

> I was going to share some tasks which use the described above process
> of number digits definition. But it seems to be much easier to define
> them looking at a number as it being just a word.
> 
> There is something I don't like. May be, it's just hard to get rid of
> the old programming heritage :-). But when we work with the
> senior students with spreadsheets (Excel, for example), the cells
> there could be also taken as a variables. And "1 or "2 there mean
> text and the attempt to summaries them will draw to an error. And the
> students won't do that if they are acquainted with the variables
> types.
> 
> So, sorry for all this mess. Though, may be it's just useful
> for students to compare:
> 
> Let "N be a number, then
> 
> last :n = remainder :n 10
> bl :n    = int :n/10    and so on.
> 
> Regards,
> Olga.
> 
> ---------------------------------------------------------------
> 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.

-- 
===============================================================
George Mills (mills@softronix.com)
http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.


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