#N canvas 788 283 600 605 10;
#X declare -lib Gem;
#X obj 14 66 gemwin;
#X obj 14 9 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1
;
#X msg 48 10 create;
#X msg 55 33 destroy;
#X obj 14 93 gemhead;
#X text 170 17 A tutorial on recursion in Gem;
#X text 170 37 (GPL) 2007 Claude Heiland-Allen <claude@mathr.co.uk>
;
#X obj 30 239 r \$0-recurse;
#X obj 68 213 v \$0-depth;
#X obj 14 193 t a b;
#X floatatom 83 170 5 1 6 2 max-depth - -;
#X obj 14 267 t a a;
#X obj 14 375 separator;
#X obj 36 586 s \$0-recurse;
#X obj 14 466 t b a b;
#X obj 99 496 v \$0-depth;
#X obj 99 516 - 1;
#X obj 99 536 max 0;
#X obj 99 556 v \$0-depth;
#X obj 36 566 spigot;
#X obj 14 496 v \$0-depth;
#X obj 14 536 v \$0-depth;
#X obj 14 516 + 1;
#X obj 68 193 f 4;
#X obj 14 396 rotate 0 0 0 1;
#X obj 156 353 * 72;
#X obj 14 416 translate 2 0 1 0;
#X obj 149 286 t f f;
#X floatatom 149 266 5 1 16 2 count - -;
#X obj 179 309 swap 360;
#X obj 179 332 /;
#X text 230 57 Recursion can be combined with iteration to make complex
structures. However \, using the [repeat] from Zexy is no longer enough.
Trying to use it with an external counter leads to re-entrancy bugs
\, because the [repeat] is retriggered before the counter has finished
\, which messes up the counter's internal state. [nrepeat] is a "repeat
with a built in counter" \, which is re-entrancy safe.;
#X obj 440 9 declare -lib Gem;
#X obj 14 320 nrepeat 4;
#X obj 14 133 scaleXYZ 0.02 0.02 1;
#X obj 60 268 square 0.8;
#X obj 14 113 rotate 20 1 0 0;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 36 0;
#X connect 7 0 11 0;
#X connect 9 0 11 0;
#X connect 9 1 23 0;
#X connect 10 0 23 1;
#X connect 11 0 33 0;
#X connect 11 1 35 0;
#X connect 12 0 24 0;
#X connect 14 0 20 0;
#X connect 14 1 19 0;
#X connect 14 2 15 0;
#X connect 15 0 16 0;
#X connect 16 0 17 0;
#X connect 17 0 18 0;
#X connect 17 0 19 1;
#X connect 19 0 13 0;
#X connect 20 0 22 0;
#X connect 22 0 21 0;
#X connect 23 0 8 0;
#X connect 24 0 26 0;
#X connect 25 0 24 1;
#X connect 26 0 14 0;
#X connect 27 0 33 1;
#X connect 27 1 29 0;
#X connect 28 0 27 0;
#X connect 29 0 30 0;
#X connect 29 1 30 1;
#X connect 30 0 25 1;
#X connect 33 0 12 0;
#X connect 33 1 25 0;
#X connect 34 0 9 0;
#X connect 36 0 34 0;
