'for' loop in gen issue
interesting... i'm no expert here, either, but looking into it, i find the inlets/outlets of gen(if not polled using the internal metro), still need to be triggered by the event-scheduler overall somehow from the outside... and if you send too many triggers, it will still produce output somehow:
also prints different if i change that gen-codebox to:
"if(in1<=3) out1 = in1 + in2; else break;"
in any case(sorry for my own digression in the 'too many triggers' discovery, and i also didn't have time to work through your code exactly but...), maybe you could work your logic around using uzi to trigger your gen, in order to iterate the output for the sequence you need(?)... i think uzi might be the fastest option for that kind of use.
hope it helps 🍻
Hi Raja,
thank you so much for taking the time to investigate!
I am aware that there are other alternatives but I remain curious why the "for" iteration doesn't work as written. 🤔
But maybe I am missing something basic in programming with gen.
Thanks again
the "for" iteration doesn't work
it is working, but just internally(otherwise, you wouldn't even get the output of the last value from the for-loop... if that makes sense...)... to iterate the output, the outlet needs to be linked to a scheduler of some sort(this is just my way of describing what i think is happening technically - if you don't use the @active and @interval attributes of 'gen', there is no internal metro active, so you need to iterate the inlets/outlets somehow with an event-scheduler object of some sort)... but if that still doesn't make sense, it's just my wording, so i bump this up for others to chime in as well.
I think something is dramatically eluding me!
If I instantiate @active 1, on the console only the last number has printed.
Uzi generates only the last number of the iteration, too.
Thanks again.
most easily done without for-loop at all(for-loop can be thought of more useful for iterations you want done internally to the codebox). just a reminder to trigger the loadmess first if trying straight from pasting:
Thanks Raja,
I would say that your thinking on the interactions recalled only internally is pretty exhaustive regarding my try!