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

Re: LOGO-L> eliminating items randomly from a list





Brian Harvey wrote: 
 >   I am beginning to think that what's needed is a new library procedure
 >   called something like EXTRACT:
 > 
 >   to extract :stuff [:index 1+random count :stuff] [:sofar []]
 >   if :index = 1 [output list (first :stuff) (se (reverse :sofar) (bf
:stuff))]
 >   output (extract (bf :stuff) (:index-1) (fput first :stuff :sofar))
 >   end
 >  ? 
 >   What do you all think?

I am a Logo illiterate;  My knowledge of Logo lets me understand the clear
programs of Yehuda, but that's about it.  Every once in a while I read a
question in Logo-L about list manipulation, and am rather amazed at the
replies.  Typically, replies fall in two categories: very long functions,
or two liners (like the one above).  To my eyes they all look
incomprehensible, and maybe too complex for what one tries to achieve.

So my questions to the forum are, can lists be treated as [dynamic] arrays?
 What is the difference between a list and an array?  If they differ, why
is that difference required?

The reason I ask is that if one considers a list as an array, then
accessing one or more contiguous elements can be done with great ease, IMO.
  Operations like extracting or inserting elements could be done even by
non-Gurus.

Chuck Shavit

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