A couple comments: Your idea of moving along the line is nice. You certainly can remove the "if not :speed = 0" if you like but you cannot remove the "restore" code. Otherwise if you call slowdraw more than once your in big trouble. There are other ways to do it as well. Note there is no reason for an "external" make. You could of simply done this: to slowdraw :thespeed make "speed :thespeed . . . end 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. Note also there are other ways to form the definition of the the new FD/BK such that you get certain parameters resolved and not others when it's being defined. I think some sprinkled SENTENCE's would of worked out better. to slowdraw :speed make "redefp "true ; Restore things if already slow if primitivep "origforward~ [ copydef "forward "origforward copydef "fd "origforward erase "origforward ] if primitivep "origback~ [ copydef "back "origback copydef "bk "origback erase "origback ] ; if a delay was specified define new slow draw routines if not :speed = 0~ [ copydef "origforward "forward copydef "origback "back erase "fd define "fd (list [d] (list "repeat :speed (list "origforward (word ": "d) "/ :speed "wait 1))) erase "bk define "bk (list [d] (list "repeat :speed (list "origback (word ": "d) "/ :speed "wait 1))) copydef "forward "fd copydef "back "bk ] make "redefp "false end MHELHEFNY@FRCU.EUN.EG wrote: > > ;Hello George Mills > ;Here is another form of the slowdraw procedure;which may look like > ;a real slowdraw. > ;(p.s. in this version you can't use slowdraw 0; you also > ;must assigne a value for the speed befor using the > ;slowdraw procedure). > ;Regards > ;Mhelhefny. > ;-------------------------------- > > to slowdraw :speed > make "redefp "true > copydef "origforward "forward > copydef "origback "back > erase "fd > define "fd [[d][repeat :speed[origforward :d/:speed wait 1]]] > erase "bk > define "bk [[d][repeat :speed[origback :d/:speed wait 1]]] > copydef "forward "fd > copydef "back "bk > end > > to demo > make "speed 60 slowdraw :speed > cs repeat 3[cstar 50] > end > > to cstar :size > fd :size > lt 120 > fd 2 * :size > lt 60 > fd 2 * :size > lt 120 > fd :size > rt 60 > end > --------------------------------------------------------------- > 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 email: 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