On 2019-05-27 18:44, Claude Heiland-Allen wrote:
On 2019-05-27 18:23, Philip Stone wrote:
On my system, the stack over-flows at count 331.
But the simplest(*) way to get recursive calls to work is often to
break the recursion with a [delay 0] to start a new depth first
execution chain after the current one is finished, or to refactor it
to use [until](+) to iterate instead of recurse.
I attached an example of both techniques.
(*) but it can become unmaintainable in larger patches...
(+) but [bang(--[until] can take a while to finish, be careful...
Claude
--
https://mathr.co.uk
#N canvas 697 133 657 266 10;
#X obj 128 84 f;
#X obj 199 104 + 1;
#X msg 128 58 0;
#X obj 76 194 spigot 0;
#X obj 128 105 t b f f f;
#X obj 121 175 < 400;
#X obj 178 144 print count;
#X text 156 56 click here;
#X obj 379 78 t f b;
#X obj 379 101 until;
#X obj 379 124 f;
#X obj 379 147 t f f;
#X obj 379 170 print count;
#X obj 426 133 + 1;
#X msg 426 101 0;
#X obj 76 217 delay 0;
#X msg 379 55 401;
#X text 406 56 click here;
#X text 453 102 retriggers new chains from here;
#X text 133 217 starts a new chain later \, allows current one to finish
;
#X connect 0 0 4 0;
#X connect 1 0 0 1;
#X connect 2 0 0 0;
#X connect 3 0 15 0;
#X connect 4 0 3 0;
#X connect 4 1 6 0;
#X connect 4 2 1 0;
#X connect 4 3 5 0;
#X connect 5 0 3 1;
#X connect 8 0 9 0;
#X connect 8 1 14 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 11 1 13 0;
#X connect 13 0 10 1;
#X connect 14 0 10 1;
#X connect 15 0 0 0;
#X connect 16 0 8 0;
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list