At 11:22 PM 3/18/98 +1000, you wrote: >Hello, >I've just joined the list so maybe this has been covered - but I didn't >see it in the archives. Can someone explain when we would use tail >recursion or embedded recursion? Perhaps an example may suffice. >Thanks in advance, >Bill Mackay > Bill ==> Here's my favorite example of tailend vs. embedded recursion. TO AMAZE :N IF :N > 120 [STOP] AMAZE :N + 10 FD :N RT 90 END TO MAZE :N IF :N > 300 [STOP] FD :N RT 90 MAZE :N +10 END Both procedures draw the same figure only AMAZE draws it in reverse. Why? Here's another one... TO TEST.RECURSION :N PR [IS THIS RECURSION?] IF READWORD = "YES [TES.RECURSION :N + 1] PRINT :N END Answer Yes a few times. Then try No. What happens? Why? These examples don't really answer your question. However, by playing with these, you may see other applications...at least I hope so. Regards...Jim Muller >+>+>+>+>+>+>+>+>+>+>+>+>+>+>+> Jim Muller jmul@cyberramp.net The Great Logo Adventure at http://www.cyberramp.net/~jmul >+>+>+>+>+>+>+>+>+>+>+>+>+>+>+> --------------------------------------------------------------- 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