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

Re: LOGO-L> slowdraw



George Mills wrote:
[snip]
> But I thought my solution was more fun (more in the spirit of
> logo/lisp) and eliminates the need for any "globals". My rule of
> thumb is not to avoid MAKE but avoid GLOBALs when possible.

Some people (not me) use closures in lisp, like:

(let ((the-speed 0))
  (defun set-speed (speed)
    (setq the-speed speed))
  (defun fd (l)
     ...
     (wait the-speed)))

where the variable the-speed is NOT global: it cannot be 
accessed except by the two functions defined in its lexical scope.
And you don't have to redefine the function fd each time you
change the speed.

Are there any closures in LOGO?

-- 
| # # | # # # | # # | # # # | # # | # # # | Jacques Duthen          |
| # # | # # # | # # | # # # | # # | # # # | duthen@club-internet.fr |
|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
---------------------------------------------------------------
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