Ticket #4099 (closed enhancement: fixed)

Opened 7 years ago

Last modified 5 years ago

TurtleArt does not support simple recursion

Reported by: dmd Owned by: bss
Priority: normal Milestone: Future Release
Component: turtleart-activity Version: Development build as of this date
Keywords: recursion recursive turtleart Cc:
Action Needed: never set Verified: no
Deployments affected: Blocked By:
Blocking:

Description

TurtleArt as currently implemented does not appear to support even simple recursion, so it can't do any of the more interesting things like drawing a Sierpinski triangle or a Koch snowflake or even computing a Fibonacci number.

This could be fixed by allowing a stack to take a box (or, better, two boxes) as an argument, such that the box would be assigned that value, and when the stack exits, the box would return to its previous value.

LOGO is a great language, but removing recursion from it strips it of most of its greatness. Recursion is an important concept that really should be available to play with, even in a simple environment like this.

Change History

Changed 7 years ago by jg

  • milestone changed from Never Assigned to V1.1

Changed 6 years ago by sleet01

I was able to get recursion working with a kludgy procedural approach, but you ain't lyin' about function-like stacks being a lot more useful.

Changed 6 years ago by dmd

Holy crap. Well done, but yeah, that's not the sort of code - or, more importantly, the sort of thinking about code - we want to encourage :)

Changed 5 years ago by walter

  • next_action set to never set

What do you think of the idea of adding push and pop? This is a more primitive but general way of addressing this issue.

Changed 5 years ago by walter

  • status changed from new to closed
  • resolution set to fixed

push and pop let you do simple recursion. I don't think I'll get around to introducing local variables, so I'll close the ticket.

Note: See TracTickets for help on using tickets.