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

Re: LOGO-L> QUESTION ON CONDITIONAL OUTPUTS



PHILLIP,

The problem in your procedure ADDLIST is that when its first line generates
the result (using OP), the execution is returned to the last line of the
previous call of ADDLIST. And in this place the result is not used,
therefore Logo reports an error (SuperLogo said: I do not know what to do
with ....).
You have to use OP also in the last line to transfer the output of one call
to the preceeding one:

TO ADDLISTS :LIST1 :LIST2 :LIST3
 IF EMPTY? :LIST1 [OP :LIST3] 
 MAKE "A1 FIRST :LIST1 
 MAKE "A2 FIRST :LIST2 
 MAKE "S :A1 + :A2 
 OP ADDLISTS BF :LIST1 BF :LIST2 LPUT :S :LIST3 
END

But still if you will call ADDLIST this way:
ADDLIST [1 2 3] [5 6 7] []
it can result (in some Logo implementations) in an error message, because
on the top level the result is still not used.
To try ADDLISTS you should use it like this:
PRINT ADDLIST [1 2 3] [5 6 7] []
or
MAKE "SUM ADDLIST [1 2 3] [5 6 7] []


Regards

Peter Tomcsanyi

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

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