Issues with counter in a loop

Jul 25, 2010 at 12:59pm

Issues with counter in a loop

dear list,

I am having a problem with counter inserted in a loop which I don’t quite understand. It is illustrated with the follwing patch :

– Pasted Max Patch, click to expand. –

I would expect it to read three lines of text and then stop, but instead it is crashing max.

What I don’t understand either is that when debugging the sequence of events, the last outlet of counter keeps reporting a carry count, and counter resets its count to 0 after the first iteration.

Thanks and Regards

Jul 25, 2010 at 3:14pm

Try resetting using the third inlet on [counter] as demonstrated in the patch below.


– Pasted Max Patch, click to expand. –
Jul 25, 2010 at 3:37pm


there were two posters, whose solutions i regularly lurked: AlexHarker and tim lloyd, now there’s three (+Luke Hall)

Brendan (Lurkio)

Jul 25, 2010 at 3:38pm


in this regard I think the behaviour of the different inlets is confusing. I would have expected that A and B (see patch) would be equivalent (A works, and B produces a stack overflow)

– Pasted Max Patch, click to expand. –


Jul 25, 2010 at 7:08pm

That is really weird. Looks like A and B should work the same. Not sure what I’m missing.

BTW, a HUGE thanks to C74 for starting to intercept stack overflows like this, it’s such an improvement to how it worked in the past… crash!

Jul 25, 2010 at 7:09pm

A well placed deferlow fixes this. I would have expected that a defer would have also fixed it, though, and am vaguely curious why it took a deferlow. Not enough to look into that, mind you, but still vaguely curious.

– Pasted Max Patch, click to expand. –
Jul 25, 2010 at 7:44pm

I think the slight delay when accessing a [text] may be the issue, I’ve ran into vaguely similar situations in the past. It might not have time to fully output its line before it gets another line command, or… something.

Jul 25, 2010 at 8:15pm

I thought it might be “something,” :-)


You must be logged in to reply to this topic.