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

Re: LOGO-L> Hello and Syntax question



What he has done here is not unique to Logo but simply a set
of Get and Set routines.

For example here is his code in "C".

His "naked" form is calling a procedure.
Logo differentiates assigning to something (with a single double quote)
from reading from (with a colon).

What is confusing is using the same name for the variable
as the procedure which I made different for clarity.
You might also rename energy to getenergy for more
clarity.

Note it may not be as english like to read but as we know
english can be ambiguous and being like english is not
always a good thing.

int gEnergy = 0;

void SetEnergy(int HowMuch)
   {
   gEnergy = HowMuch;
   }

int GetEnergy()
   {
   return gEnergy;
   }

void MoreEnergy()
   {
   SetEnergy (GetEnergy() + 1);
   }

Here is the same logo code with only names changed:

make "gEnergy 0

to SetEnergy :how.much
make "gEnergy :how.much
end

to GetEnergy
output :gEnergy
end

to MoreEnergy
SetEnergy GetEnergy + 1
end

>
>My question arises from the difference between Logo and my experience with
>several other procedural computer languages and applications. What is the
>basis for the difference in variable passing in the following code taken
from
>an article on event-driven programming by Michael Tempel:
>
>to setenergy :how.much
>make "energy :how.much
>end
>
>to energy
>output :energy
>end
>
>to more.energy
>setenergy energy + 1
>end
>
>Energy is dealt with in three different "forms": 1) a naked form used in
the
>third procedure, 2) an "coloned" form used in both the parameter list of
the
>procedural definition of 'setenergy' and the passing of energy to OUTPUT ,
and
>3) a quoted form used as the first argument to MAKE. What is the rule that
>determines the acceptable packaging of variable? I can accept that there
>should be the quoted form for naming, but why should there be two different
>forms for passing variables that will clearly need to be evaluated?
>
>I don't want to leave the impression that I just went out and bought this
>package and immediately sent this message. I have been interested in AI for
>decades, have tried to learn LISP and LOGO in prior incarnations on Z80/CPM
>and earlier Mac versions. The manuals and additional books I have purchased
>and read have not really explained this difference. The error massages are
>opaque in the extreme. Can anyone shed some light? (Why don't the error
>messages have some kind of explanation that say what is really going on?)
>
>Thanks, David Winsemius, MD
>dwinsemius@home.com
>using Mac 6100/60, 40Meg, system 7.6, HyperStudio v 3.1
>---------------------------------------------------------------
>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.
>

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