This uses two procedures s and t which call each other recursively. That is each calls itself as part of its own definition. This is a very powerful programming idea but it has to be used carefully as it is a very effective way to either run out of memory or lock your computer up.
sThis procedure constructs a square on the line (x1,y1) (x2,y2) passed to it in the procedure call.
to s :x1 :y1 :x2 :y2 :level |
The variables are made local so that they don't interfere with subsequent calls to the procedure. |
tThis draws an isocoles triangle on any line supplied with a height equal to half the length of the base line.
to t :x1 :y1 :x2 :y2 :level |
|
Square and Triangle
| |
Square Starfish
|
Tree Forgery
|