Opened 8 years ago

Closed 7 years ago

#4099 closed enhancement (fixed)

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:
Blocked By: Blocking:
Deployments affected: Action Needed: never set
Verified: no


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 (5)

comment:1 Changed 8 years ago by jg

  • Milestone changed from Never Assigned to V1.1

comment:2 Changed 8 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.

comment:3 Changed 8 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 :)

comment:4 Changed 7 years ago by walter

  • Action Needed 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.

comment:5 Changed 7 years ago by walter

  • Resolution set to fixed
  • Status changed from new to closed

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.